Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL in a Form

Status
Not open for further replies.

SATYR76

Technical User
Jan 30, 2004
5
0
0
US
below is the code i am using in a form

'" Begining of Code"

Private Sub AppenCD192_Click()

Dim strSQL1 As String

strSQL1 = "INSERT INTO Tbl_CO_CD_192 Select * FROM tbl_CD_192 " & _
" INNER JOIN tbl_CD_192 ON tbl_Employee_Computer_Data.Collector_Code = tbl_CD_192.CCODE;"

DoCmd.RunSQL strSQL1

End Sub

' End of Code

When i run this it gives me a "syntax error in join operation"

Can anyone help me with this

Thanks
 
I think your query should read something like this:

Code:
strSQL1 = "INSERT INTO Tbl_CO_CD_192 Select * FROM tbl_CD_192 " & _
          " INNER JOIN  [b]tbl_Employee_Computer_Data[/b] ON tbl_Employee_Computer_Data.Collector_Code = tbl_CD_192.CCODE;"

Hope that helps.

VJ
 
hello VJ

thanks for the help I had to add one thing to it but i got it to work

strSQL1 = "INSERT INTO Tbl_CO_CD_192 Select tbl_CD_192.* FROM tbl_CD_192 " & _
" INNER JOIN tbl_Employee_Computer_Data ON tbl_CD_192.CCODE = tbl_Employee_Computer_Data.Collector_Code;"

Thanks again
MJ
 
I am glad that it worked for you in the end.

-VJ
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top