Greater Than Message Box

  • Thread starter pushrodengine via AccessMonster.com
  • 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
 
J

John W. Vinson

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
 

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

Similar Threads


Top