Solved

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

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

623 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