on click event

Strike_Eagle

Registered User.
Local time
Today, 09:10
Joined
Oct 20, 2011
Messages
48
I have a form that populates all of the specialist for the supervisor that is logged in. I created a macro, then deleted and created vba, for an on click event on the specialist name to pull up a report. If you pull the report up on its own you must type in the specialist name. What I want the event to do is pass the clicked on name to the report. Unfortunately I cannot upload the database. Here is what I had for the vba though.

Sub

DoCmd.OpenReport "rptPersonel", , "Specialist_Name =" & Me.Specialist_Name

Unfortunately this is not my database and I am just helping out. The report parameter and the form name have the same name which is why you see specialist twice.

Hour do I get the name clicked on to the report to just show that specialist?
Also hire do I keep it from trying to print.

Thanks to all in advance.
 
You're missing one comma and quotes and use acViewPreview to keep from printing and view it first.

DoCmd.OpenReport "rptPersonel", acViewPreview, , "Specialist_Name =" & Chr(34) & Me.Specialist_Name & Chr(34)
 
I'm going to guess that Specialist_Name is a text field so you will need to enclose it in inverted comas, see the adjustments I've made to your code;

Code:
DoCmd.OpenReport "rptPersonel", , "Specialist_Name =[COLOR="Red"]'[/COLOR]" & Me.Specialist_Name [COLOR="Red"]& "'"[/COLOR]
 
Thanks guys I'm pretty sure I did those but will try it again. Unfortunately it will be Wednesday before I get that opportunity. I am going to have the guy working on the database see this and can try and update on Monday.

Thank you for your replies! Have a great weekend
 

Users who are viewing this thread

Back
Top Bottom