Greater Than Message Box

  • Thread starter Thread starter pushrodengine via AccessMonster.com
  • Start date Start date
P

pushrodengine via AccessMonster.com

I would like a message box to appear when the value entered in textbox
“TimeA†is greater than the valued entered in textbox “TimeBâ€.

The message box should have two buttons “OK†and “CANCELâ€.

Thanks
 
I would like a message box to appear when the value entered in textbox
“TimeA” is greater than the valued entered in textbox “TimeB”.

The message box should have two buttons “OK” and “CANCEL”.

Thanks

I'd suggest using the Form's BeforeUpdate event (so it won't matter which
textbox the user fills first):

Private Sub Form_BeforeUpdate(Cancel as Integer)
Dim iAns As Integer
If IsNull(Me!TimeA) Then
MsgBox "Please fill in TimeA", vbOKOnly
Cancel = True
Exit Sub
End If
If IsNull(Me!TimeB) Then
MsgBox "Please fill in TimeB", vbOKOnly
Cancel = True
Exit Sub
End If
If Me!TimeA > Me!TimeB Then
iAns = MsgBox("Do you really want TimeA greater than TimeB?", vbOKCancel)
Cancel = (iAns = vbCancel)
End If
End Sub
 
Back
Top