Null value in combo box

Ryko

Registered User.
Local time
Today, 16:43
Joined
Nov 27, 2005
Messages
35
Hi!

I'm trying to handle an error when the user deletes the value selected in combo box which eventually leads to the "You tried to assign the Null value to a variable that is not a Variant data type" error message. I haven't even thought about it before receiving user feedback on this thing.

I have a combo box that is limited to list and I can handle errors when the user writes something unexpected in the combo box, using the "On Not In List" event, but apparently this event is not triggered in case of deletion (= Null value).

I've tried to put extra code under different events to prevent the Null value error message, with little success. Any suggestions?

Cheers,
Ryko
 
Lookup "on error statement" in the VBA help. Use Error handling methods to deal with errors when they occur.
 
Well, I eventually came around this problem using the Nz function. It seems to work fine with this line in the OnChange event of the combo box

Me.ComboBox = Nz(Me.ComboBox, "")

Now users are unable to type in or delete anything, all they can do is select from the list.
 
I've same problem, but I need to set null to combo box and is it possible?
 

Users who are viewing this thread

Back
Top Bottom