Unexplainable Syntax Error

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

In access 2003 why would this produce a syntax error of:
(missing operator) Device ID=Motor 1
DoCmd.OpenReport "YourReport", acPreview, , "YourPrimaryKey = " &
Me![YourPrimaryKeyControl]
 
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....
 
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]
 
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!
 
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
 
Back
Top