Print From Combo Box Selection

P

Pam

Is there code for the OnClick property of a combo box to print a report when
selection is clicked? Not sure what to put after DoCmd.PrintOut
"ReportName" ,,,
I have one set up with a combo box and command button where the DoCmd is on
the command button and references the relating combo box, but I would like
to eliminate the button and just select from combo box, if possible.
Help is greatly appreciated!!
Thanks,
Pam
 
R

Rick Brandt

Pam said:
Is there code for the OnClick property of a combo box to print a
report when selection is clicked? Not sure what to put after
DoCmd.PrintOut "ReportName" ,,,
I have one set up with a combo box and command button where the DoCmd
is on the command button and references the relating combo box, but I
would like to eliminate the button and just select from combo box, if
possible. Help is greatly appreciated!!
Thanks,
Pam

DoCmd.OpenReport "ReportName"

Without the acViewPreview argument supplied OpenReport does in fact just
send your report straight to the printer.
 
G

Guest

That is the how. The where is in the After Update event of the combo box.

which of course can't be canceled :)
 
P

Pam

I'm sorry, the combo doesn't give a list of reports to choose from, but a
list of names for a report. I have a report based on a query with a field
for JobAssigned. The combo box lists technician's names. I want to select
a tech name and have the report print a list of just that person's jobs.
I'm thinking something like "JobAssigned=combobox" but not sure how to
reference it. With the combo box/command button one references the other.
 
B

Brian Bastl

if the bound column of your combo is text, then your Where condition would
read
"[JobAssigned]='" & mycombobox & "'"

if it's numeric, then:
"[JobAssigned]=" & mycombobox

HTH,
Brian

BTW, if you reply to your own post instead of replying to the other
poster's, the person(s) helping you won't necessarily be informed that
you're continuing the thread. I'd guess that this is the reason for the
delay in replying to you.
 
P

Pam

Thanks, Brian
It worked out great!!
Brian Bastl said:
if the bound column of your combo is text, then your Where condition would
read
"[JobAssigned]='" & mycombobox & "'"

if it's numeric, then:
"[JobAssigned]=" & mycombobox

HTH,
Brian

BTW, if you reply to your own post instead of replying to the other
poster's, the person(s) helping you won't necessarily be informed that
you're continuing the thread. I'd guess that this is the reason for the
delay in replying to you.



Pam said:
I'm sorry, the combo doesn't give a list of reports to choose from, but a
list of names for a report. I have a report based on a query with a
field
for JobAssigned. The combo box lists technician's names. I want to select
a tech name and have the report print a list of just that person's jobs.
I'm thinking something like "JobAssigned=combobox" but not sure how to
reference it. With the combo box/command button one references the
other.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top