Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

doCmd not working

Status
Not open for further replies.

rry2k

Programmer
Jun 28, 2001
678
US
Hi,
I have a form that will allow the user to select different options for different views in a report. I'm trying to use the where parameter in this doCmd statement. I took this out of a parm query that I wrote that does work outside the macro. When I run it from the form, I get an object not found.

Thanks for the help..Russ
Private Sub Option0_Click()
DoCmd.OpenReport "presentation", acViewPreview, , Presentation01.Candidate1 Like "*" & [Type a candidate:] & "*"
 
not sure I can solve your problem, but I have worked a little with statements like these. Try using ' ' or ` ` around your parameters.
 
The way that I pass values to reports where the queries contain input parameters is to pass the value using the SendKeys function prior to calling the report. Of course, you'd need to make the query accept the filter as a parameter.

Neil Konitzer, President
Freisoft
 
can you elaborate on that?
Thanks..R
 
Try this - strings in where conditions must have quotes around them, whereas numbers don't so you could have

"[CandidateID] = " & me.candidateid

but

"[Candidatename] = " & chr(39) & me.candidatename & chr(39)

chr(39) is a single quote - I find it easier to do it this way so that I don't have to nest quotes

Private Sub Option0_Click()
DoCmd.OpenReport "presentation", acViewPreview, , "Presentation01.Candidate1 Like " & chr(39) & "*" & [Type a candidate:] & "*" & chr(39)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top