required textbox entry

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

Guest

kinda of stupid question but my brain is on vacation. wondering how to make
it so on a non bounded textboxon a form, a user is required to enter a value
and is
not allowed to leave the textbox without doing so?
 
hi
Private Sub textbox1_BeforeUpdate(Cancel As Integer)
If IsNull(Me!textbox1) Then
MsgBox (" Enter something.")'centers sortof
Exit Sub
end if
end sub
 
Capture the null value in the onexit event:


Unbounded textbox Text0 on exit event ..

Private Sub Text0_Exit(Cancel As Integer)
If Text0.Text = "" Or Text0.Text = Null Then
Dim response As Integer
response = MsgBox("Hey how about a value here", vbOKOnly)
DoCmd.CancelEvent
End If
End Sub

Ed Warren
 
Back
Top