a message box keeps coming up...

T

Tom

I need to have a Message Box that pops up, after updating
a 'memo' field in a subform, if a 'txt' field in a main
form is empty, reminding user to fill it out.
I used the following code in the BeforeUpdate event of the
memo field:

If IsNull(Me.Parent!NameOfTextField) Then
MsgBox "Please fill out text field on main form",,"Txt
field Empty"
Cancel = True
End If

but I got a problem, the message box keeps coming up and
won't let me click on anywhere else.
Help me figure this out,
many thanks,
 
T

Tom

Hi Neil, good to see you
Move the code to the BeforeUpdate event of the form not
the memo field? How it would know after updating memo
field launch the MsgBox? Can you describe me a little bit
in details,
 
N

Neil

Sorry Tom, I didn't see the subform part. Right...

scrap moving the code to the BeforeUpdate of the subform. Instead, remove

Cancel = True

from your code. This is cancelling the before update event of the memo text
box and preventing you from moving on. However, looking forward, does it
matter if you remind the user that this field on the main form is empty and
they still dont enter anything into this box? You would check the value for
this field in the BeforeUpdate event of the main form and Cancel the event
if the field is still blank if this is a required field.

Neil.
 

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

Top