Input Required

  • Thread starter Thread starter Steven R via AccessMonster.com
  • Start date Start date
S

Steven R via AccessMonster.com

I developed a input form for users to input and one of the fields is
expiration date - I know that I can make that a required field, but can I
make a more custom-designed message using VBA code that would prompt the user
to input an expiration date if they tried to get off the expiration date
field ?
 
I developed a input form for users to input and one of the fields is
expiration date - I know that I can make that a required field, but can I
make a more custom-designed message using VBA code that would prompt the user
to input an expiration date if they tried to get off the expiration date
field ?

Well, what would you do if they never set focus to the expiration date
field at all!?

Instead, use the Form's BeforeUpdate event:

Private Sub Form_BeforeUpdate(Cancel as Integer)
If IsNull(Me!txtExpirationDate) Then
MsgBox "Expiriation date must be filled in", vbOKOnly
Cancel = True
Me!txtExpirationDate.SetFocus
End If
End Sub

John W. Vinson[MVP]
 
John,
Thanks !

Steve


John said:
Well, what would you do if they never set focus to the expiration date
field at all!?

Instead, use the Form's BeforeUpdate event:

Private Sub Form_BeforeUpdate(Cancel as Integer)
If IsNull(Me!txtExpirationDate) Then
MsgBox "Expiriation date must be filled in", vbOKOnly
Cancel = True
Me!txtExpirationDate.SetFocus
End If
End Sub

John W. Vinson[MVP]
 
Back
Top