Error Msg

  • Thread starter Thread starter capinvest
  • Start date Start date
C

capinvest

I am trying to set up a button that will look at the
current client record, find the clients ID number and then
print a client specific report. I have the following code
behind the button:

DoCmd.OpenReport "Situation", acViewPreview, , "[main].
[ID] = " & Me![ID]

I get the following error when I try to use the button:

Extra ) in query expression '([main].[ID] = )'.

Any help with this problem will be very appreciated.
Thanks.
 
Hi, the message suggests that there is no value in the field (?) Me.ID.
Try each of the following:
If ID is numeric:
DoCmd.OpenReport "Situation", acViewPreview, , "[main].[ID] = " &
Nz(Me![ID],0)
If ID is text:
DoCmd.OpenReport "Situation", acViewPreview, , "[main].[ID] = '" &
Nz(Me![ID],"") & "'"

Hope this helps, Graeme.
 
Back
Top