Solved

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

Posted on 2013-01-17
3
1,290 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 500 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

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

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

It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

762 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