textbox

A

Allen Browne

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top