Resetting cascade combo boxes.

F

FPSC

I have three combo boxes in a form that requery and then the subform gives
the results.

Everything works fine but...:

when I look for another set of values, I would like to have all combo boxes
cleared (blank) like when you open the form the first time.

If is possible to Reset #2 & #3 combo Boxes when #1 Got Focus again, how
can I do that?
Also if I just want to change combo box #2 how to clear combo #3 as soon as
combo #2 Got Focus again.

Any help will be highly appreciated.

Thanks
SC
 
D

Dirk Goldgar

FPSC said:
I have three combo boxes in a form that requery and then the subform
gives the results.

Everything works fine but...:

when I look for another set of values, I would like to have all combo
boxes cleared (blank) like when you open the form the first time.

If is possible to Reset #2 & #3 combo Boxes when #1 Got Focus
again, how can I do that?
Also if I just want to change combo box #2 how to clear combo #3 as
soon as combo #2 Got Focus again.

Any help will be highly appreciated.

Thanks
SC

If they're unbound, you can use code in the GotFocus events:

Private Sub Combo1_GotFocus()
Me!Combo2 = Null
Me!Combo3 = Null
End Sub

Private Sub Combo2_GotFocus()
Me!Combo3 = Null
End Sub

If they're bound, you probably don't want to do that, since that would
involve potentially changing the values of fields in existing records.
 
F

FPSC

Thank you very mcuh Dirk. It works perfectly.

One more question:

If I want to close another form called Picture at the same time I clear the
Combo boxes what code I need to add?
Because I used a Macro to do that, but now with the Eventprocedure the macro
cannot be used.

Thanks again.

SC
 
F

FPSC

I got it.
Thanks anyway the code I used is:

DoCmd.Close acForm, "NameOfCurrentForm"

Thank you very much for your help./
 

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