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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Syntax error in JOIN operation, help!!

Status
Not open for further replies.

gavray

Programmer
Jul 17, 2000
65
GB
HI,

I get the following error when trying to query two tables from a strID, which is a unique job ID

Any ideas gratefully received, thanks

Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

[Microsoft][ODBC Microsoft Access Driver] Syntax error in JOIN operation.

CODE-

sSQL="SELECT JobTable.Salary, JobTable.CompanyID, CompanyTable.ID, CompanyTable.Company"
sSQL=sSQL & " FROM JobTable AS Salary"
sSQL=sSQL & " INNER JOIN CompanyTable AS Company"
sSQL=sSQL & " ON CompanyTable.ID = JobTable.CompanyID"
sSQL=sSQL & " WHERE ID= " & strID & ""
sSQL=sSQL & " ORDER BY JobTable.Salary;"

cheers

Gav
 
Your SQL statement should be:

sSQL="SELECT JobTable.Salary, JobTable.CompanyID, CompanyTable.ID, CompanyTable.Company"
sSQL=sSQL & " FROM JobTable"
sSQL=sSQL & " INNER JOIN CompanyTable"
sSQL=sSQL & " ON JobTable.CompanyID = CompanyTable.ID"
sSQL=sSQL & " WHERE JobTable.ID= " & strID
sSQL=sSQL & " ORDER BY JobTable.Salary;"

Simon
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top