PopUp help

  • Thread starter Thread starter Chad
  • Start date Start date
C

Chad

Hello, I have a text box that has a set value of 8 in it. If someone changes
the number to 4 then I would like a pop up to come up stating "If overtime is
worked then status box must be checked". How would I do this?

Thanks!
 
To expand on the other response, you would probably use something like this
in the text box Before Update event:

If Me.SomeTextBox <> 8 Then
MsgBox "Status box must be checked"
Me.chkStatus.SetFocus
End If

Or to refine it a bit:

Dim strMsg as String
strMsg = "Was overtime worked? If so, " & _
"status box will be checked"
If Me.SomeTextBox <> 8 Then
If MsgBox(strMsg,vbYesNo) = vbYes Then
Me.chkStatus = True
Else
Me.Undo
Me.SomeTextBox.SetFocus
End If
End If

SomeTextBox is the text box in which the 8 (or whatever) is stored.

On the other hand, if Status is dependent entirely on the contents of the
text box it may not be necessary at all. You may be using two fields to
store the same information. As it is, if the number gets changed from 4
back to 8 then you would need more code to uncheck the Status box.
 
Where

YourTextBox is the actual name of the target textbox:

Private Sub YourTextBox_AfterUpdate()
If Me.YourTextBox = 4 Then
MsgBox "If overtime is worked then status box must be checked !"
End If
End Sub

--
There's ALWAYS more than one way to skin a cat!

Answers/posts based on Access 2000/2003

Message posted via AccessMonster.com
 
Back
Top