Nulls

Pauldohert

Something in here
Local time
Yesterday, 18:49
Joined
Apr 6, 2004
Messages
2,097
I have my field set in SQL not to accept null and to default to 0.

When a user edits the field from access, they can delete the value and try to put a null in. On attempting to leave the field I get the error - "You tried to assign the Null value to a variable that is not a Variant data type".

Something like "Please enter a value!" would be a better message. How can I get a friendly message without having to do something for all fields on my forms?

Ta
 
have you tried trapping the error and substituting your own message?
 
How do I do that - which event would have the error - it occurs before beforeUpdate event.
 
FoFa said:
have you tried trapping the error and substituting your own message?

Problem this type of message is generated in the database and is not seen as an error by both SQL server and Access, the same prob with foreign key messages.
So you can't trap it unless you use triggers on the table which raise an error when an empty field is being forgotten.

In my personal opinion allowing nulls and using the conditional formatting in access is more user friendly, when it's empty the field should show red, set it in the conditional formatting. In most conditions this is more user friendly as most people want to leave something blank for some time and the red field is a reminder.
 

Users who are viewing this thread

Back
Top Bottom