textbox

  • Thread starter Thread starter eve
  • Start date Start date
Use the BeforeUpdate event procedure of the *form* to trap this situation.
As you know, the Before Update event does not fire for the text box if
nothing is typed into it.

Private Sub Form_BeforeUpdate(Cancel As Integer)
If IsNull(Me.[MyTextbox]) Then
If MsgBox("You forgot MyTextbox. Continue anyway?", _
vbYesNo+vbDefaultButton2) = vbNo Then
Cancel = True
End If
End If
End Sub

If you wanted to insist that the record should never be saved when the field
is left blank:
1. Open your table in design view.
2. Select the field.
3. In the lower pane, set Required to Yes.
 
Back
Top