Invalid Use of Null

dancarter

Registered User.
Local time
Today, 20:03
Joined
Aug 24, 2006
Messages
10
Hi,
I have some code that runs on Form_Load()
It basically uses a case statement to say if a value in a combo box equals one set of values then make somethings visible and invisible, and for all other values make some other things visible and invisible.

The problem I have is that I have defined the variable as a String and if the combo box does not yet have a value when it loads, which is quite likely then it will return an error - "Invalid Use of Null".

Can anyone help to see any way around this?

Thanks,
Dan
 
You could use the Nz function. Say your variable is called MyVariable and your combobox is called Cmbo1.

Dim MyVariable as String

MyVariable = Nz(Me.Cmbo1,"ComboEmpty")

The in your select case list you need to provide instructions for when MyVariable = "ComboEmpty"
 
woohoo! hadn't seen that function before that works for me
Thanks very much
 

Users who are viewing this thread

Back
Top Bottom