Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Blank a requeried combo box

Status
Not open for further replies.

Acipenser

Technical User
Oct 15, 2001
39
US
I have 2 combo boxes. They are set up so that the information selected in combo1 controls the information listed in combo 2. The choice in the combo1 can be changed and combo2 requeries it's list. No problem there. What I would like it to do is this.

I want combo2 to be blank (null) if nothing is selected in it (the way the combo box starts out). I also want the box to re-blank whenever combo1 is changed. Presently it keeps the last selected item in combo2 until you manually change it after updating combo1.

I use the 2 combo boxes in a query to open a new form. If the old data in combo2 remains after changing combo1 then it messes up the query. Changing to blank (null) would be fine (would query all data for combo1).

What do i need to do?
 
me.combo2 = "" will clear it for you
placeing in some event section should do it
since Im not sure when you want it cleared it hard to say what event to placre the code in
good luck
 
braindead2,

Your method did not work for me, but it did help me to figure it out. The reason your method did not work is that the code me.combo2 = "" assigns a blank string to the combo box. When I use that in the query it returns no values. What I really needed was a null. So I put me.combo2 = Null instead which returns all data associated with combo1. I placed it right before requerying combo2 in the AfterUpdate event for combo1. Everything is working great.

Thanks for the help, Acipenser
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top