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!

I'm getting a syntax error on this VBA-SQL code.....

Status
Not open for further replies.

colezpapa

Programmer
Feb 26, 2007
86
US
I'm getting a syntax error on this sql code....
can anyone see what I am doing incorrectly..

StringSQL = "SELECT Doc_Account.Account_ID,Doc_Account.SubmitDate, Doc_Account.CompleteDate,Doc_Account.Status, Doc_Account.AccountName, Lookup_TypeOfWOrk.TypeOfWork_Desc

StringSQL = StringSQL & " FROM Lookup_TypeOfWOrk INNER JOIN Doc_Account ON Lookup_TypeOfWOrk.WorkID = Doc_Account.TypeofWork"

StringSQL = StringSQL & " INNER JOIN Issues ON Doc_Account.Account_ID = Issues.LinkID "

StringSQL = StringSQL & " INNER JOIN Documents ON Issues.DocumentLabelName = Documents.Document_Name;
 
All string literals have to begin AND end with double quotes. Check out your first line, it is missing the ending double quote.
 
Code:
StringSQL = "SELECT Doc_Account.Account_ID,Doc_Account.SubmitDate, Doc_Account.CompleteDate,Doc_Account.Status, Doc_Account.AccountName, Lookup_TypeOfWOrk.TypeOfWork_Desc[!]"[/!]
StringSQL = StringSQL & " FROM [!](([/!]Lookup_TypeOfWOrk INNER JOIN Doc_Account ON Lookup_TypeOfWOrk.WorkID = Doc_Account.TypeofWork[!])[/!]"
StringSQL = StringSQL & " INNER JOIN Issues ON Doc_Account.Account_ID = Issues.LinkID[!])[/!]"
StringSQL = StringSQL & " INNER JOIN Documents ON Issues.DocumentLabelName = Documents.Document_Name;"

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top