clear the value in a dependent combo box

Geordie2008

Registered User.
Local time
Today, 23:26
Joined
Mar 25, 2008
Messages
177
:DHi all,

I have 2 combo boxes "cbo_Region" which filters "cbo_Country"

After updating "cbo_Region" I run this code which updates the list of values avail in the Country combo...


Private Sub cbo_Region_AfterUpdate()

cbo_Country.Requery

End Sub


Question: How do I get it to clear out the value that is currently in the "cbo_country" when the "cbo_Region" value is changed....?

Thanks,
Mandy
 
try setting the "value" of the combobox ;)
 
me.cboCountry = ""

???
 
Mmmmm i dont think Im explaining the prob very well....

When I change the region from Asia to Europe..... the country field will still be populated with Thailand...

So it will look....


REgion: Europe
Country: Thailand

I want it to look:

Region: Europe
Country: [blank]

so teh user defo remembers to update it.....

I need after event vba on the region combo to change the value of the country combo to blank....

Thanks,
Mandy
 
Have you tried the suggestions offered? They should work unless I'm still missing something...
 
They should work unless I'm still missing something...
Nope you right...

Tho maybe you might want to change "" to Null and maybe "setfocus" to the now Blank combo?
 
I put the following code within the AfterUpdate event of the cbo_Region properties...


Private Sub cbo_Region_AfterUpdate()

cbo_Country.Requery
Me.cboCountry = Null
SetFocus.cboCountry

End Sub


It did'ne work.....

If you guys already tested this and it works... am I just putting the code in the wrong palce?

I get complie errors....

on Me.cboCountry = null [method or data member not found]

Have a nice w.e. all!
Mandy
 
It works like a charm, use it all the time.
Find attached a quick 2002 sample.

It should probably be cbo_country
and maybe you can try "" instead of null.

Also I think it is cbo_country.setfocus
 

Attachments

I am a muppet..... Twas the "_" I was missing!

Thanks, have a great weekend!
M
 
Sometimes its the small things that matter. This is one of the reasons I allways preach:
Dont use "_" or spaces or anything special in names... Just concatinate them and be done with it.
 

Users who are viewing this thread

Back
Top Bottom