Combobox populated

  • Thread starter Thread starter John
  • Start date Start date
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
 
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
 
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
 
Back
Top