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

Checking values on a form via combo box after_update

Status
Not open for further replies.

jtseltmann

Programmer
Jan 15, 2002
149
US
I have a strange problem that I cannot seem to figure out. Here is the setup:

I have a form that is opened from the main menu. On this form there are a few combo boxes. If the user selects a value from the combo box it calls a sub that will attempt to enable/disable fields on that same form. The after_update event fires and calls the sub correctly BUT the first time the form is opened it will not let me use the following check:
If Form_MainMenu.chkBox1.value = -1 Then...
or
If Form_MainMenu.cmbCombo1.value = "" Then...

Both of these return errors saying the "You have entered an expression that has no value"

It only happens when the MainInfo form is blank...I can't understand what is up? The MainInfo form is loaded and open. I click the drop down and the code fires correctly. All variables are set correctly but I can't enable/disble fields at all. BUT if I close the main info form and reopen it..all works fine...?

Does anyone have any thoughts that may push me in the right direction?
Thanks all for your time.
J
 
Maybe you need to check for null values instead of the values you're asking for.

So, you might change it to:

If IsNull(Form_MainMenu.chkBox1.value) Then...
or
If IsNull(Form_MainMenu.cmbCombo1.value) Then...

Or if that doesn't work, perhaps on the second one, you could try vbNullString instead of "".

--

"If to err is human, then I must be some kind of human!" -Me
 
Yes, i only put a snippet of the if then statement to give you the idea. It doesn't care what it is it won't let me check the "value" property. BUT the situation just got stranger...I got tired of messing around and saved all and closed access.

I reopened it and opened that form and it works fine?!? Its almost like a bug but I can't be sure.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top