Solved

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

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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
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…
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.
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

803 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