Hello All,
I have a form to enter contact information, and often the sponsor info and the manager info is the same contact info. I am trying to use VBA to copy the information over to save me a bunch of time.
This is what I have:
The problem is that when I click the button right now it pops up the error: "Syntax error (comma) in query expression '(Project_Manag ed_By, Manager_Salutat ion, Manager_First_N ame, Manager_Last_Na me, Manager_Title, Manager_Address , Manager_City, Manager_Provinc e, Manager_Postal_ Code, Manager_Phone, Manager_Fax, Manager_Email)' ." And as far as I can see the SQL statement is how it should be, so I need someone with more SQL experience than me to see the issue.
I appreciate any information or guidance that you can offer. Thanks! :)
I have a form to enter contact information, and often the sponsor info and the manager info is the same contact info. I am trying to use VBA to copy the information over to save me a bunch of time.
This is what I have:
Code:
Private Sub Command28_Click()
'VBA to copy all manager info to matching sponsor.
On Error GoTo Err_Button_Click
Dim ssql As String
ssql = "INSERT INTO [tblSponsorInfo] (Sponsor_Name, Sponsor_Salutation, Sponsor_First_Name, Sponsor_Last_Name, Sponsor_Title, Sponsor_Address, Sponsor_City, Sponsor_Province, Sponsor_Postal_Code, Sponsor_Phone, Sponsor_Fax, Sponsor_Email)" & _
"SELECT (Project_Managed_By, Manager_Salutation, Manager_First_Name, Manager_Last_Name, Manager_Title, Manager_Address, Manager_City, Manager_Province, Manager_Postal_Code, Manager_Phone, Manager_Fax, Manager_Email)" & _
"FROM [tblManagerInfo]" & _
"WHERE SHC_No = SHC_No;"
CurrentDb.Execute (ssql)
MsgBox ("The info was copied to the Sponsor Contact.")
Exit_Button_Click:
Exit Sub
Err_Button_Click:
MsgBox Err.Description
Resume Exit_Button_Click
End Sub
I appreciate any information or guidance that you can offer. Thanks! :)
Comment