G
Guest
Greetings,
Access 97, combo box recordsource is 2 columns from a table. LimitToList is
True.
I'd like to allow users to hit the Delete key while focus is on my combo and
hit Tab or Enter. I want to trap the appropriate event with code to prompt
if they really want to delete the record (I can take it from there if I get
that far). I also want them to be able to use the NotInList event to
prompt/add records to the combo recordsource if they type in a new entry.
That code is already in place.
Problem is that, as soon as I Tab away from the combo with the entry
deleted, I get runtime error 3162, "Can't assign a Null value..." I've tried
to capture a Null in the box value with BeforeUpdate, but apparently
NotInList happens first and the "NewData" argument in that proc is predefined
as as String (which I believe is what's causing the error).
The only way I've been able to get this to work is a workaround I'm a bit
uncomfortable with - to capture the error in the Form's error event, bypass
it and then run my code for the prompt/delete. If this error occurs for any
other reason than my design I'll have problems.
Any ideas on this would be appreaciated!
Access 97, combo box recordsource is 2 columns from a table. LimitToList is
True.
I'd like to allow users to hit the Delete key while focus is on my combo and
hit Tab or Enter. I want to trap the appropriate event with code to prompt
if they really want to delete the record (I can take it from there if I get
that far). I also want them to be able to use the NotInList event to
prompt/add records to the combo recordsource if they type in a new entry.
That code is already in place.
Problem is that, as soon as I Tab away from the combo with the entry
deleted, I get runtime error 3162, "Can't assign a Null value..." I've tried
to capture a Null in the box value with BeforeUpdate, but apparently
NotInList happens first and the "NewData" argument in that proc is predefined
as as String (which I believe is what's causing the error).
The only way I've been able to get this to work is a workaround I'm a bit
uncomfortable with - to capture the error in the Form's error event, bypass
it and then run my code for the prompt/delete. If this error occurs for any
other reason than my design I'll have problems.
Any ideas on this would be appreaciated!