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.
 
Thank you, that solved my problem. That is a huge weight
lifted off my shoulders. Thanks again.

-----Original Message-----
Try simply "[ID] = " & Me![ID]
--
Steve Arbaugh
ACG Soft
http://ourworld.compuserve.com/homepages/attac-cg

capinvest said:
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.


.
 
I read the above post with interest and I have a similar (if more complex) problem.

I am using a recordset for a search form. the SQL string for the recordset is as follows:

SELECT Title, FirstName, Surname, PCT, WorkBase, JobRole, LogBookNo, PersonalNo FROM tblDelegate WHERE (((Title)=" & strTitle & ")) OR (((FirstName)=" & strFirstName & ")) OR (((Surname)=" & strSurname & ")) OR (((PCT)=" & strPCT & ")) OR (((WorkBase)=" & strWorkBase & ")) OR (((JobRole)=" & strJobRole & ")) OR (((LogBookNo)=" & strLogbookNo & ")) OR (((PersonalNo)=" & strPersonalNo & "));

The code I have used is behind a button. When the button is clicked i get the same message as the user above did.

There are a lot of brackets in there but an equal no of ( to ). I have declared all the variables. If a null value is in a text box when the button is pressed I have an IF statement that sets the variable to "'""'" (double quote, single quote, 2x double quote, single quote, double quote) so it is no longer null but simply blank. I have removed al the [me].[txtBoxName] references so they just read [txtBoxName] now.

Is the problem in the recordset even though I copied it straight from SQL view in query design and just removed references to the table?

Can anyone help?

Thanks
 
Last edited:
Back
Top