3075: Syntax error (missing operator) in query expression

S

siaosanko

Hi,

I'm writing in VBA MS access, and when i run my form i got a runtim
error: 3075
and it was debugged at the following code:

I can't figure it out what's wrong with my code, would you please help
me out with it?

Thanks a lot!!!

The error message points at "Mod = "", but i don't know what's wrong ?

======================================

strSQL = "Select * from Result where Proc = '" & Trim(rsTarget!Proc)
& "' And Mod = '" & Trim(rsTarget!Mod) & "'"
Set rs2 = CurrentDb.OpenRecordset(strSQL)

=======================================

Thansk a lot for the help!!
 
G

Gina Whipp

siaosanko,

First thing I noticed was you are missing the ending syntax (the
semi-colon). Try replacing your strSQL with the one below...

strSQL = "Select * from Result where Proc = '" & Trim(rsTarget!Proc) & "'
And Mod = '" & Trim(rsTarget!Mod) & "';"

--
Gina Whipp

"I feel I have been denied critical, need to know, information!" - Tremors
II

http://www.regina-whipp.com/index_files/TipList.htm
 
R

RoyVidar

Hi,

I'm writing in VBA MS access, and when i run my form i got a runtim
error: 3075
and it was debugged at the following code:

I can't figure it out what's wrong with my code, would you please
help me out with it?

Thanks a lot!!!

The error message points at "Mod = "", but i don't know what's wrong
?

======================================

strSQL = "Select * from Result where Proc = '" & Trim(rsTarget!Proc)
& "' And Mod = '" & Trim(rsTarget!Mod) & "'"
Set rs2 = CurrentDb.OpenRecordset(strSQL)

=======================================

Thansk a lot for the help!!

Could the Mod field be Null? Mod is also a reserved Word in Access
(the name of a function), and shouldn't be used as field name.

Perhaps (if not Null), it might work with a bit of [bracketing]?

Both Mod and Proc are text fields? If not, you need to amend the
delimiters (single quote for text, hash (#) for dates, none for
numeric).

BTW Proc is a reserved word in Jet, so that will also need to be
[bracketed]

"Select * from Result where [Proc] = '" & Trim(rsTarget![Proc])
& "' And [Mod] = '" & Trim(rsTarget![Mod]) & "'"

Here are some lists of reserved words
http://support.microsoft.com/kb/321266/EN-US/
http://support.microsoft.com/default.aspx?scid=kb;en-us;286335
 
L

littlestone

I'm writing in VBA MS access, and when i run my form i got a runtim
error: 3075
and it was debugged at the following code:
I can't figure it out what's wrong with my code, would you please
help me out with it?
Thanks a lot!!!
The error message points at "Mod = "", but i don't know what's wrong
?

 strSQL = "Select * from Result where Proc = '" & Trim(rsTarget!Proc)
& "' And Mod = '" & Trim(rsTarget!Mod) & "'"
 Set rs2 = CurrentDb.OpenRecordset(strSQL)

Thansk a lot for the help!!

Could the Mod field be Null? Mod is also a reserved Word in Access
(the name of a function), and shouldn't be used as field name.

Perhaps (if not Null), it might work with a bit of [bracketing]?

Both Mod and Proc are text fields? If not, you need to amend the
delimiters (single quote for text, hash (#) for dates, none for
numeric).

BTW Proc is a reserved word in Jet, so that will also need to be
[bracketed]

"Select * from Result where [Proc] = '" & Trim(rsTarget![Proc])
 & "' And [Mod] = '" & Trim(rsTarget![Mod]) & "'"

Here are some lists of reserved wordshttp://support.microsoft.com/kb/321266/EN-US/http://support.microsoft.com/default.aspx?scid=kb;en-us;286335

thanks. i don't know why i used those reserved words!!
 
D

Douglas J. Steele

For a comprehensive list of names to avoid (as well as a link to a free
utility to check your application for compliance), check what Allen Browne
has at http://www.allenbrowne.com/AppIssueBadWord.html

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



-
Show quoted text -

thanks. i don't know why i used those reserved words!!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top