On Wed, 14 May 2008 21:03:37 GMT, Steve Goodrich wrote:
Hi Fred
I'm still not able to do this. Don't know what I'm doing wrong.
I copied and pasted your text into the before update event on my form
and
changed the name of the checkbox to my own, but I am still allowed to
enter
a record and go to the next record without the message box popping up.
Basically the check box serves as a reminder to staff that they have
completed another task before submitting the record
Steve
On Tue, 13 May 2008 21:18:21 GMT, Steve Goodrich wrote:
I have a check box on my form that I want a message box to pop up if
the
check box is not ticked when the form is submitted.
I've done this before but it was a while ago and I've forgot!
If I recall it was something like:
If me.fieldname = false then
msgbox "please check box"
end if
obviously I've remembered it wrong because it doesn't work.
Also does it go in the before or after update section
Thanks for any help
Steve
Code the Form's BeforeUpdate event:
If Me.CheckBoxName = 0 then
MsgBox = "You must check the check box."
Cancel = True
End If
But it the check box must always be checked, why not just set it's
default to -1 and not bother the user with it,
or... if it always needs to be checked why have it at all?
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
When something like this occurs it's always useful for you to post the
complete code you actually wrote (including the Sub Procedure name).
That way we can see what you actually did, not what you say you did.
Sometimes there is a BIG difference.

Nothing personal with the
comment. Just a helpful hint.
It works for me. Here is the entire event code I used.
Note.... In my previous reply I inadvertently wrote
MsgBox = " etc.."
when I should have written
MsgBox " etc..." (no = sign)
The below code is correct.
Private Sub Form_BeforeUpdate(Cancel As Integer)
If Me.[Check] = 0 Then
MsgBox "You must check the check box."
Cancel = True
End If
End Sub
Change [Check] to the actual name of your check box
Make sure it's in the FORM's BeforeUpdate event, not of a control on
the form.