Combobox populated

J

John

Hi,
Before I print a report by clicking a command button [btnPrintRpt] I select
a record from a combobox list [cboCandidates].
This is then the basis of the report.

Firstly: How do I make the command button check to make sure that a record
is selected

Secondly: Is it possible to make the combobox empty again when the command
button is clicked to print to prevent the user accidentally printing off
multiple records.

Here's hoping

Regards

John
 
D

Dale Fye

Sure.

Private sub cmd_Print_Click

if LEN(me.cbo_YourComboName & "") = 0 then
msgbox "Select an item from the combo box!"
me.cbo_YourComboName.Setfocus
exit sub
endif

docmd.openreport "ReportName", ....

me.cbo_YourComboName = NULL

Exit Sub

HTH
Dale
 
J

John

Dale.
Many thanks, it worked a treat.

Regards

John

Dale Fye said:
Sure.

Private sub cmd_Print_Click

if LEN(me.cbo_YourComboName & "") = 0 then
msgbox "Select an item from the combo box!"
me.cbo_YourComboName.Setfocus
exit sub
endif

docmd.openreport "ReportName", ....

me.cbo_YourComboName = NULL

Exit Sub

HTH
Dale
--
Don''t forget to rate the post if it was helpful!

email address is invalid
Please reply to newsgroup only.



John said:
Hi,
Before I print a report by clicking a command button [btnPrintRpt] I
select
a record from a combobox list [cboCandidates].
This is then the basis of the report.

Firstly: How do I make the command button check to make sure that a
record
is selected

Secondly: Is it possible to make the combobox empty again when the
command
button is clicked to print to prevent the user accidentally printing off
multiple records.

Here's hoping

Regards

John
 

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