Dim itemctr As Variant
If IsNull(Item_No) Then
itemctr = DCount("Item_No", "dbo_PMOption_History"
Item_No = itemctr + 1
End If
This is my simple code that automatically assigns item number everytime a record is added. Unfortunately I get error that says "You tried to assign the Null value to a variable that is not a Variant data type (Error 3162)". It will assign a number though but the error keeps popping-up everytime a new record was added.
Item_No is the key field in dbo_PMOption_History that doesn't allow Null Value.
Does someone have an idea why I get this error.
Thanks for any help!