B
Billp
Hi,
The main form/table has an Autonumber ID called "Customer_Record_ID" and is
the main key.
A feild called "CustomerID" is a unique 6 letter identifier for the form.
The subtable is linked to the main form/table via "CustomerID" in a many to
one.
Upon selecting the "CustomerID" via a combo box (Column 0) I am trying to
copy all
records in a subtable relating to that 'CustomerID" and paste them into the
new subform as part of the new record under the new "CustomerID".
The new records are a duplicate of the old reference. Say the old refernce
had 9 records - I need those 9 reords to copy to the new subform and to be
linked to it by the new "CustomerID".
I have the following,
'now to copy the subform CustomerContacts
'CustomerID is a unique identifier which must be copied to link the tables
'possibly an sql insert into statement
Dim strSql As String 'SQL Satement
strSql = "INSERT INTO [tblCustomerContacts](
CustomerID,LastName,FirstName,ContactName,Title,Region,WorkPhone,WorkDDI," _
&
"WorkExtension,MobilePhone,FaxNumber,EmailName,Has_Left,Corp_Brochure," _
&
"Calendar_Sent,Diary,Last_Visit_Date,Last_Contact,Enquiry_Status,Follow_Up," _
&
"ContactNotes,ContactsInterests,Birthdate,Hometown,HomePhone,MaritalStatus," _
&
"SpousesName,SpousesInterests,ChildrensNames ) " & _
"SELECT " & Me![CustomerID] & "As NewCustomerID,
LastName,FirstName,ContactName,Title,Region,WorkPhone,WorkDDI,WorkExtension,"
_
&
"MobilePhone,FaxNumber,EmailName,Has_Left,Corp_Brochure,Calendar_Sent," _
&
"Diary,Last_Visit_Date,Last_Contact,Enquiry_Status,Follow_Up," _
&
"ContactNotes,ContactsInterests,Birthdate,Hometown,HomePhone,MaritalStatus," _
&
"SpousesName,SpousesInterests,ChildrensNames" & _
"FROM [tblCustomerContacts] WHERE [CustomerID] =
Me!Cust_Alias_ID.Column(0)"
DBEngine(0)(0).Execute strSql, dbFailOnError
Me!frmCustomerContacts.Requery
Alas and alac I now get
Error 3075 - Syntax error missing operator.
Kiwi not flying anymore.
Any help appreciated.
The main form/table has an Autonumber ID called "Customer_Record_ID" and is
the main key.
A feild called "CustomerID" is a unique 6 letter identifier for the form.
The subtable is linked to the main form/table via "CustomerID" in a many to
one.
Upon selecting the "CustomerID" via a combo box (Column 0) I am trying to
copy all
records in a subtable relating to that 'CustomerID" and paste them into the
new subform as part of the new record under the new "CustomerID".
The new records are a duplicate of the old reference. Say the old refernce
had 9 records - I need those 9 reords to copy to the new subform and to be
linked to it by the new "CustomerID".
I have the following,
'now to copy the subform CustomerContacts
'CustomerID is a unique identifier which must be copied to link the tables
'possibly an sql insert into statement
Dim strSql As String 'SQL Satement
strSql = "INSERT INTO [tblCustomerContacts](
CustomerID,LastName,FirstName,ContactName,Title,Region,WorkPhone,WorkDDI," _
&
"WorkExtension,MobilePhone,FaxNumber,EmailName,Has_Left,Corp_Brochure," _
&
"Calendar_Sent,Diary,Last_Visit_Date,Last_Contact,Enquiry_Status,Follow_Up," _
&
"ContactNotes,ContactsInterests,Birthdate,Hometown,HomePhone,MaritalStatus," _
&
"SpousesName,SpousesInterests,ChildrensNames ) " & _
"SELECT " & Me![CustomerID] & "As NewCustomerID,
LastName,FirstName,ContactName,Title,Region,WorkPhone,WorkDDI,WorkExtension,"
_
&
"MobilePhone,FaxNumber,EmailName,Has_Left,Corp_Brochure,Calendar_Sent," _
&
"Diary,Last_Visit_Date,Last_Contact,Enquiry_Status,Follow_Up," _
&
"ContactNotes,ContactsInterests,Birthdate,Hometown,HomePhone,MaritalStatus," _
&
"SpousesName,SpousesInterests,ChildrensNames" & _
"FROM [tblCustomerContacts] WHERE [CustomerID] =
Me!Cust_Alias_ID.Column(0)"
DBEngine(0)(0).Execute strSql, dbFailOnError
Me!frmCustomerContacts.Requery
Alas and alac I now get
Error 3075 - Syntax error missing operator.
Kiwi not flying anymore.
Any help appreciated.