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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do you use a combo box in an If statement?

Status
Not open for further replies.

NeoZakz

Technical User
Jul 22, 2002
25
0
0
US
Im trying to write an if in VB that will check a combo box and see if its blank or not and if so go onto one of the other statements. Anyway is there a way to do that?

If Me![Govt] Is Null Then

Didn't work so Im assuming theres a special way to check combo box's?
 
The contents of the combobox as displayed on the form is indeed given by referencing its name so the test If IsNull(Me![cboxName]) should work provided of course that Me is the current active form. If not then you will will have to be explicit about it using the Forms object. Caveat - the form still needs to loaded but it need not be the current active form if you specify the form name.
 
if isnull(govt.value) then
'do something
else
'do something else
end if Bastien

There are many ways to skin this cat,
but it still tastes like chicken
 
It looks like one of those 2 will work. Thanks alot I just wasn't sure how to get it to read a null value if there is one. Ill go try those out.

Thanks again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top