View Single Post
  #3  
Old April 29th, 2008, 07:43 PM posted to microsoft.public.access.forms
Gabriella777_2
external usenet poster
 
Posts: 65
Default Adding a MsgBox when criteria are true

Okay, I did as you suggested and it worked accept . . .
1. I got a pop up saying I can't go to the specified record after clicking
on the command button I created to go to the next record.
2. When I clicked the Close Form command button, I got the msgbox but after
clicking okay it closed the form anyway.
I added a SetFocus line to what you had me put in, with it setting Textbox 2
as the focus. That worked on the next record button but not on the close form
button.
--
Thanks and God bless you and yours,
Gabriella777_2



"Douglas J. Steele" wrote:

Since it's possible that they might not actually tab through the second
textbox, I'd recommend putting the logic in the form's BeforeUpdate Event:

Private Sub Form_BeforeUpdate(Cancel As Integer)

If Me.Textbox1 0 And IsNull(Me.Textbox2) = True Then
MsgBox "You must provide a value for both Textbox1 and Textbox2"
Cancel = True
End If

End Sub

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"Gabriella777_2" wrote in message
...
I have a a form that contains 2 text boxes that are not used every time the
form is used. However, if the first box is used the second must be used.
So
do I create a MsgBox to pop up based on an if then equation(?)?
The end result would be that when the user exits the second text box
(OnExit) it would look at the previous box and determine if the default
value
($0.00) was changed (always a 0 amount). If yes, and the exited text
box
is still empty, then put up a pop up to remind that it must be filled in.
Does that makes sense or is there an easier way?
--
Thanks and God bless you and yours,
Gabriella777_2