Anything wrong???

richardplr

Registered User.
Local time
Tomorrow, 03:55
Joined
Jun 10, 2003
Messages
239
Hi

I insert this code, but not working.

DoCmd.OpenReport stDocName, acPreview, , "[Requisitor] =" & Me.[Requisitor]
DoCmd.Maximize
DoCmd.RunCommand acCmdZoom75


I have a form with a preview button and when I click this button, I can preview the report of whatever ID that is on the form.

Example:

My main form show employee ID 4, if I click the preview button, it will go straight to the report of ID 4.

Please help
 
Richard,

What exactly is it doing wrong? It brings up the report. It has the right
employee.

Wayne
 
Richard,

Try acViewPreview, instead of acPreview.

Wayne
 
WayneRyan said:
Richard,

Try acViewPreview, instead of acPreview.

Wayne

Hi Wayne.

Thanks for your help. But it give me this error (See attached)
 

Attachments

  • preview error.jpg
    preview error.jpg
    52.9 KB · Views: 124
Richard,

DoCmd.OpenReport stDocName, acPreview, , "[Requisitor] = '" & Me.[Requisitor] & "'"

You have to add the single-quotes to tell SQL that the name is a string.
In your prior post, you said employee #4.

That should fix it.

Wayne
 
WayneRyan said:
Richard,

DoCmd.OpenReport stDocName, acPreview, , "[Requisitor] = '" & Me.[Requisitor] & "'"

You have to add the single-quotes to tell SQL that the name is a string.
In your prior post, you said employee #4.

That should fix it.

Wayne


Ya... you are right.

I am so sorry to give a wrong example. Anyway, I am really thank you for your help.

Bye
:p
 

Users who are viewing this thread

Back
Top Bottom