MS Access Error: 3162: “You tried to assign the Null value to a variable that is not a Variant data type.”

Background:

All of a sudden importing data from spreadsheet in a form produced the above error(it was tested and worked fine over two weeks), the same operation in another form is executing fine. This is bit frustrating when everything seems fine, no errors in logic or elsewhere but things are not working.

Solution:

Digging down further found that error is causing for a field in the underlying table should be supplied with value(can’t be NULL) but the field or column is set to Required:No at table level. When changing the SQL INSERT by omitting the columns except the required one it works fine. Finally deleted then copied the underlying external table with another identical one solved it.

Leave a Reply

Your email address will not be published. Required fields are marked *