Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Run-time error 3075: syntax error (missing operator) in query expression - Access VBA

Posted on 2013-01-17
3
Medium Priority
?
1,416 Views
Last Modified: 2013-01-17
Hi all.

I get the above error at this line of code. What am I missing? I copied pasted from a SQL View:

Set rsExcel = CurrentDb.OpenRecordset("SELECT  tblFreightQuote_Header.QuoteNumber FROM  tblFreightQuote_Header INNER JOIN  tblFreightQuote_SalesOrder ON tblFreightQuote_Header.FreightQuote_ID = tblFreightQuote_SalesOrder.FreightQuote_ID INNER JOIN tblFreightQuote_Carrier ON tblFreightQuote_Header.FreightQuote_ID = tblFreightQuote_Carrier.FreightQuote_ID LEFT OUTER JOIN tblFreightQuote_Invoice ON tblFreightQuote_SalesOrder.SalesOrder_ID = tblFreightQuote_Invoice.SalesOrder_ID")

Open in new window

0
Comment
Question by:printmedia
3 Comments
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 38787757
<I copied pasted from a SQL View:>

did you removed the "(" and ")" parentheses

copy again and don't remove the parentheses
0
 
LVL 61

Accepted Solution

by:
mbizup earned 2000 total points
ID: 38787763
Try this:

Set rsExcel = CurrentDb.OpenRecordset("SELECT  tblFreightQuote_Header.QuoteNumber FROM  ((tblFreightQuote_Header INNER JOIN  tblFreightQuote_SalesOrder ON tblFreightQuote_Header.FreightQuote_ID = tblFreightQuote_SalesOrder.FreightQuote_ID) INNER JOIN tblFreightQuote_Carrier ON tblFreightQuote_Header.FreightQuote_ID = tblFreightQuote_Carrier.FreightQuote_ID) LEFT JOIN tblFreightQuote_Invoice ON tblFreightQuote_SalesOrder.SalesOrder_ID = tblFreightQuote_Invoice.SalesOrder_ID")

Open in new window


Or this:

Set rsExcel = CurrentDb.OpenRecordset("SELECT  tblFreightQuote_Header.QuoteNumber FROM  ((tblFreightQuote_Header INNER JOIN  tblFreightQuote_SalesOrder ON tblFreightQuote_Header.FreightQuote_ID = tblFreightQuote_SalesOrder.FreightQuote_ID)  LEFT JOIN tblFreightQuote_Carrier ON tblFreightQuote_Header.FreightQuote_ID = tblFreightQuote_Carrier.FreightQuote_ID) LEFT JOIN tblFreightQuote_Invoice ON tblFreightQuote_SalesOrder.SalesOrder_ID = tblFreightQuote_Invoice.SalesOrder_ID")

Open in new window

0
 

Author Closing Comment

by:printmedia
ID: 38787776
Thanks!
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

876 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question