Incorrect syntax '='

User avatar
adam
SilverLounger
Posts: 2347
Joined: 23 Feb 2010, 12:07

Incorrect syntax '='

Post by adam »

Hi anyone,

Im trying to inner join 4 tables.

But I'm getting the error incorrect sytax near '='. How can I solve this?

Code: Select all

strSQL = "SELECT BillDetail.ItemCode,CashMain.BilledPersonName,CashMain.BillType, CashMain.BillPersonID, CashMain.BilledAddress, region.regionname, country.countryname FROM ((CashMain INNER JOIN country On CashMain.BilledPersonCountry = country.countrycode)INNER JOIN region On CashMain.BilledPersonregion = region.regioncode) INNER JOIN BillDetail On CashMain.BillID = BillDetail.BillNo WHERE CashMain.BillID=" & Range("L9").Value
Any help would be kindly appreciated.
Best Regards,
Adam

User avatar
HansV
Administrator
Posts: 78411
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Incorrect syntax '='

Post by HansV »

Please attach a zipped copy of the database (replace the real data with a few dummy records)
Best wishes,
Hans

User avatar
adam
SilverLounger
Posts: 2347
Joined: 23 Feb 2010, 12:07

Re: Incorrect syntax '='

Post by adam »

Thankyou for the reply Hans. I've changed my mind not to use inner join from four tables as the fourth table no longer exits in the database.
Best Regards,
Adam