A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Greater Than Message Box



 
 
Thread Tools Display Modes
  #1  
Old February 27th, 2008, 10:39 PM posted to microsoft.public.access.forms
pushrodengine via AccessMonster.com
external usenet poster
 
Posts: 106
Default Greater Than Message Box

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

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...forms/200802/1

  #2  
Old February 27th, 2008, 11:43 PM posted to microsoft.public.access.forms
John W. Vinson
external usenet poster
 
Posts: 18,261
Default Greater Than Message Box

On Wed, 27 Feb 2008 22:39:13 GMT, "pushrodengine via AccessMonster.com"
u36225@uwe wrote:

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
--
John W. Vinson [MVP]
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 04:58 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright 2004-2024 OfficeFrustration.
The comments are property of their posters.