W
winsa
Hi
Using A2K3, SQL backend.
I have a bound combo box displaying 2 columns (of a possible 5).
LimitToList is set to Yes.
I am using the following test in the Click event of a Save&Close button on
the form: If Len(Me.Debtor & VbNullString) = 0 Then Msgbox "Error"
This works if I haven't touched the combo box at all when filling in the
form, the error message will fire. However, if I select a Debtor, tab off or
leave the combo box, go back and delete the entry using the backspace key,
the error message will not fire when the Save&Close button is clicked.
Access seems to bypass the error message and tries to save, which it
obviously can't because Debtor is a required field, and thereby throws up the
INSERT fails error.
To me it looks like an empty combo box as I thought I had deleted all the
text. However, I have noticed that whenever I go back to the combo box,
there seems to be an entry of 5 spaces?!? I have tried testing this in the
NotInList event, but that event doesn't seem to fire. I have also tried
testing in the BeforeUpdate event too, but same result, ie. nothing!
Can anybody explain why this is happening and/or how I can then test whether
or not this field is null/empty before continuing?
Any help would be greatly appreciated.
Using A2K3, SQL backend.
I have a bound combo box displaying 2 columns (of a possible 5).
LimitToList is set to Yes.
I am using the following test in the Click event of a Save&Close button on
the form: If Len(Me.Debtor & VbNullString) = 0 Then Msgbox "Error"
This works if I haven't touched the combo box at all when filling in the
form, the error message will fire. However, if I select a Debtor, tab off or
leave the combo box, go back and delete the entry using the backspace key,
the error message will not fire when the Save&Close button is clicked.
Access seems to bypass the error message and tries to save, which it
obviously can't because Debtor is a required field, and thereby throws up the
INSERT fails error.
To me it looks like an empty combo box as I thought I had deleted all the
text. However, I have noticed that whenever I go back to the combo box,
there seems to be an entry of 5 spaces?!? I have tried testing this in the
NotInList event, but that event doesn't seem to fire. I have also tried
testing in the BeforeUpdate event too, but same result, ie. nothing!
Can anybody explain why this is happening and/or how I can then test whether
or not this field is null/empty before continuing?
Any help would be greatly appreciated.