By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,743 Members | 1,018 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,743 IT Pros & Developers. It's quick & easy.

Runtime 3075 (syntax error) missing operator

P: 2
Hello - I'm getting a run time error 3075 (missing operator) in my query expression and cannot seem to determine why. I cut a snippet of code (see below) and ran the statement in a sql query view and it returned the values back as perfectly. However, I get the qdf.SQL = strSQL debug for this statement when I try an run it in a form:

'Set the final Query Statemnt
strSQL = "SELECT * FROM wktbl_YTDTransactions Where " & strQuery & ";"

I'm lost. Any ideas as to what could be missing? Any responses are greatly appreciated
Mar 12 '12 #1
Share this Question
Share on Google+
3 Replies

Expert Mod 10K+
P: 12,356
That depends on what's in strQuery.
Mar 12 '12 #2

P: 2
Thanks for the reply. Here is an excerpt of the code along with the statement with strQuery:

Expand|Select|Wrap|Line Numbers
  1. strQuery = strQuery & "wktbl_YTDTransactions!" & tCtrl.ControlSource & " IN(" & strCriteria & ")"
  2.                 strQuery = strQuery & " AND "
  3.             End If
  5.         End If
  7.       Next tCtrl
  9.     'Trim the last AND off the strQuery or it will throw an error
  10.      strQuery = Left(strQuery, Len(strQuery) - 5)
  12.      'Set the final Query Statemnt
  13.      strSQL = "SELECT * FROM wktbl_YTDTransactions Where " & strQuery & ";"
  15.      qdf.SQL = strSQL
  17.      DoCmd.OpenQuery "sysqry_YTDTransactions Query"
Mar 12 '12 #3

Expert Mod 10K+
P: 12,356
Please use code tags.

It now depends on what's in strCriteria. Why do you keep leaving out information that we need?

Also, what is "wktbl_YTDTransactions!"? If it's a table, you can't use the exclamation mark. If it's a form control, you forgot the Form! in front.
Mar 12 '12 #4

Post your reply

Sign in to post your reply or Sign up for a free account.