Prevent Access from updating a blank record

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How can I prevent an update of a blank record. When user clicks in list field I have on form even if I make listField = "", Access still updates the record. How do I validate it for blank and throw it out using VBA code?
 
I hope I'm understanding your question properly, in that you don't want the
list box's AfterUpdate event to fire when clicking in a blank listbox,
which, in fact, is what happens. Try putting the following code in the
ListBox's BeforeUpdate event procedure:

If IsNull(Me.lstMyListbox) Then
Me.lstMyListbox.Undo
Cancel = True
End If

HTH. Reid

Macy said:
How can I prevent an update of a blank record. When user clicks in list
field I have on form even if I make listField = "", Access still updates the
record. How do I validate it for blank and throw it out using VBA code?
 
Back
Top