Combobox Clearing

  • Thread starter Thread starter jlkrk1
  • Start date Start date
J

jlkrk1

Guest
I have a combobox on a form that is the criteria for a report. After selecting from the combobox, there is a button that kicks of the macro that kicks of the report. All of this works fine. When I close the report, and return to the form (it's sitting just behind the report), the combobox is still showing the criteria selected. Is there a way after I close the report (using the close button on the report) and return to the form for the combobox to be empty? Thanks, Jim
 
I'm not sure if this is what you're referring to, but...Use the Close event for the report you're viewing. Go to the design view of the report and enter the code that clears the combobox(YourComboBox="") to the Close event of that report. The form must be open though or you will get an error. I hope that helps.
 
I tried your suggestion and it didn't work. This is what I have in the "On Close" event.
"=([Forms]![Main_Form]![Combo10]="")" But nothing happens on the form when I close the report. Have I done this correct? Thanks for you help. Jim
 
Hi jlkrk1

The problem you have may be related to the value of your combo being a number, not text
Try
#1 Delete that On_Close event from report then: - using On_Activate event of your FORM: enter: -- [Combo10] = 0

#2 Or use the On_Close event
But your On_Close event should read:- [Forms]![Main_Form]![Combo10] = 0 (or if text "")
ie. delete the "=" and the "( )" ---- these are not necessary and may be causing orig problem!!
 
Jim,
Ron Bell has it right.
I should've made myself clearer. Sorry about that. I just realized that you can also set your combobox = null.
[Forms]![Main_Form]![Combo10] = null
That should work w/ text and numbers especially if the combo's bound column is the primary key in your table.
 
Guys, sorry to keep being a pain. None of these are working. Ron, your #1 suggestion for the "On Activate" won't work because I have a "Docmd" to maximize the for in that slot. Other than that I have tried these and none have worked yet. When I remove the = and () from =([Forms]![Main_Form]![Combo10]="")it views the field as a macro and says it can't find this macro. Also, although I am attempting this with [Combo10], I will need to apply it to 8 other combo's that launch reports. If anybody has Netmeeting maybe we could set up a Netmeeting and I could share the database with you. If not, if anybody has any other suggestions I really appreciate your help. Thanks, Jim
 
Jim,

Could you post the entire procedure your using? Maybe you have a syntax problem of some kind.
 
Here's another suggestion:
Save your macro as a Module. Copy it into the module of the form. Place it in the "Click" event of the button that kicks off the report instead of the code that kicks off the macro. This way, you can put
"Me.cboName = null" at the end and the report will get the information it needs before the cbo goes null.
 

Users who are viewing this thread

Back
Top Bottom