Help with combo box behaviour

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



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.

--
Regards
Winsa

.



Relevant Pages

  • Re: required fields
    ... If you attempt to close the form while some required fields are left blank, ... entry before closing. ... Cancel = True ... error message if they try to close the form without entering all required ...
    (microsoft.public.access.forms)
  • Re: required fields
    ... to prevent Access saving the record if the field is null. ... entry before closing. ... Cancel = True ... error message if they try to close the form without entering all required ...
    (microsoft.public.access.forms)
  • Re: error 3078:
    ... I made those changes but I still receive the same error message ... "Stuart McCall" wrote: ... Set db = CurrentDb ... ' Compute change from entry week scores & put into tables ...
    (microsoft.public.access.modulesdaovba)
  • Re: Windows Media Tools Corruption
    ... I have put a copy of the error message in the same picassa file as the ... A copy of the entry can be found here. ... weird if it also does that in WMP9 menus too, ... in the command window type ...
    (microsoft.public.windowsmedia)
  • Re: Coding newbie requests help.
    ... I tried your suggestion but I'm getting an error message. ... just use the ID field of your combobox to requery. ... Open the form which enables a new entry in one of the above ... Complete data entry without having to refresh the form & relocate the ...
    (microsoft.public.access.formscoding)