Unexplainable Syntax Error

D

Dustin

In access 2003 why would this produce a syntax error of:
(missing operator) Device ID=Motor 1
DoCmd.OpenReport "YourReport", acPreview, , "YourPrimaryKey = " &
Me![YourPrimaryKeyControl]
 
K

Ken Snell [MVP]

Post the whole code, please. My first glance would say that the

Device ID = Motor 1

is the problem, but I hate to jump to conclusions....
 
D

Dustin

The Code Entered is:

Private Sub Command75_Click()
DoCmd.OpenReport "Cathodic Data Sheet", acPreview, , "Electrical ID &"
Me.[Combo78]

End Sub

Combo 78 is where motor 1 returns from a lookup field Electrical ID is my
primary key and the syntax error I get says that I am missing an operator in
the expression that is returned which is Electrical ID=Motor 1
--
Dustin


Ken Snell said:
Post the whole code, please. My first glance would say that the

Device ID = Motor 1

is the problem, but I hate to jump to conclusions....

--

Ken Snell
<MS ACCESS MVP>


Dustin said:
In access 2003 why would this produce a syntax error of:
(missing operator) Device ID=Motor 1
DoCmd.OpenReport "YourReport", acPreview, , "YourPrimaryKey = " &
Me![YourPrimaryKeyControl]
 
V

Van T. Dinh

Try:

DoCmd.OpenReport "Cathodic Data Sheet", acPreview, , _
"[Electrical ID] = """ & Me.[Combo78] & """"

Don't use space or other special characters in names. If you do, make sure
you have the square brackets to delimit the actual names!
 
D

Dustin

Thank You Very Much that has been bugging me all day and it's the last thing
I have to get working in this database. Thank You Thank you Thank You
--
Dustin


Van T. Dinh said:
Try:

DoCmd.OpenReport "Cathodic Data Sheet", acPreview, , _
"[Electrical ID] = """ & Me.[Combo78] & """"

Don't use space or other special characters in names. If you do, make sure
you have the square brackets to delimit the actual names!
--
HTH
Van T. Dinh
MVP (Access)



Dustin said:
The Code Entered is:

Private Sub Command75_Click()
DoCmd.OpenReport "Cathodic Data Sheet", acPreview, , "Electrical ID &"
Me.[Combo78]

End Sub

Combo 78 is where motor 1 returns from a lookup field Electrical ID is my
primary key and the syntax error I get says that I am missing an operator
in
the expression that is returned which is Electrical ID=Motor 1
 

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