invalid use of null?

skate

Registered User.
Local time
Today, 20:04
Joined
May 22, 2002
Messages
136
Aargh! Can't understand why this doesn't work! I have a procedure that displays the values selected from 4 combo boxes in one line, but if the user deletes a value or it is blank (value not yet selected in the combobox), I get "invalid use of null". So I put
If IsNull (Mycombo) Then
Mycombo=" "
Endif

in the OnEnter, OnLostFocus, OnChange...whatever I could, but it just does not like empty values! So now when I want to go to a new record (and of course all values are blank) I get the same error message over and over. How can I solve this?
 
I'm assuming that you've set your fields so that they will not accept a ZERO Length?

I've actually added NONE or " " selection options to my combo boxes and then set them as the default values. That way I can still query for them and I know that I will have some sort of data for every field!
 
is there a zero length property for comboboxes?

I guess I could put in a blank field for the combobox but the problem is the values for the combobox are entered initially by the user, so they may not know to do that.
 
how do you check blank values in comboboxes?

is it correct to use IsNull to check that no value is selected/deleted in the combobox?
 
There is a zero length property for the field that the combo box sources back too. So if someone tyes 20 numbers into a 10 value text field....you're combo box should not accept the selection because it shouldnot be accepted by the table.

Sort of like making the source field mandatory...it's not mandatory to have a combo box, but it is mandatory to provide data back to that field! That's where the "None" or "N/A" option comes in!

The " " will work, but the "" will not. "" is treated as IsNull and required fields will not accept it.

Just add " ";"Other Options";"Other Options"

With the " " as a selection option, set the default to " " and you shouldn't have the error anymore!

Hope it helps
:rolleyes:
 
Ok, this is kinda strange to me. I left a blank record that the combobox sources from. In the table, the combobox list shows the empty field along with the other options. But in the form (that's based on the table), that blank option doesn't show up?!?
 

Users who are viewing this thread

Back
Top Bottom