Solved

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

Posted on 2013-01-17
3
1,247 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 119

Expert Comment

by:Rey Obrero
Comment Utility
<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
Comment Utility
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
Comment Utility
Thanks!
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
Familiarize people with the process of utilizing SQL Server stored procedures 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 Micr…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.

772 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now