error 3162 - Null value to non-variant type (combo box)
Posted on 2006-06-19
Hi, I've seen this posted several times but still don't understand how to resolve this issue in my case.
I have a combo box on a form, cboRealtors. This combo box shows a list of realtors that it gets from a simple query on the tblRealtor table. The combo box is bound to a column in the form recordset called ID_Realtor.
Initially, the combo box is empty. Then, you can select a realtor from the drop-down list and everything works fine. Problem is, if you want to remove any selections from the combo box to leave it blank again, you get this error:
error 3162 - "You tried to assign the null value to a variable that isn't a variant data type."
in the underlying table, Required=Yes. There is no default value, however looking at the table, all of the unnassigned ID_Realtor fields have a 0 in them.
I don't think adding any code to the AfterUpdate or OnExit procedures for the combo box will work--this error gets thrown before either of those are executed.
Also, I read somewhere that Access may be confused about which variable to assign the value to? I'm confused about this as there's no controls on the form with the same name ID_Realtor and I never defined any other variables in my code with a Dim statement with that name. The only place that name exists is the field name in the underlying table.
Anyone know how I can delete a realtor and leave the combo box empty after selecting one without getting this error?