Solved Customize the error message "You tried to assign the value Null to a variable that is not a Variant data type" (1 Viewer)

zelarra821

Registered User.
Local time
Today, 20:12
Joined
Jan 14, 2019
Messages
803
Hi.

I have a form with a dropdown. As it takes values from another table with which it is related, and saves the code in the source table of the form, if the user leaves the field empty, the message "You tried to assign the value Null to a variable that is not a Variant data type ". I have tried with all the possible events, but none of them allow me to customize that error (which would basically consist of replacing the error by putting a default value that I always add in the drop-down, type No data).

I don't know if you understand what I mean. How could I do it?
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 12:12
Joined
Aug 30, 2003
Messages
36,118
I would test for it in the before update event:


You can probably also catch it in the form's error event if you want.
 

zelarra821

Registered User.
Local time
Today, 20:12
Joined
Jan 14, 2019
Messages
803
Thank you very much for answering. It does not work. Look:
ScreenShot002.jpg


ScreenShot003.jpg


ScreenShot004.jpg
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 12:12
Joined
Aug 30, 2003
Messages
36,118
The link recommends the form's before update event, not the individual control's.
 

zelarra821

Registered User.
Local time
Today, 20:12
Joined
Jan 14, 2019
Messages
803
Ok, now it works perfectly. Thank you very much for the help.
 

Users who are viewing this thread

Top Bottom