Check box

G

Guest

I wrote this question to in the general questions, it might be appropriate to
write this question in this form:

I have a check box in a form. I want a msg box to pop up everytime it is
clicked on. Asking the user if he/she wants to continue. If user says yes
then the box changes from unchecked to checked or from checked to unchecked.
If user says no then the box stays the same. Im having problems writing the
code for this.
Thanks to those who can help.
 
G

Guest

On the before update event of the check box, you can try this code

If MsgBox("Do you wants to continue?", vbYesNo) = vbNo Then
Cancel = True
SendKeys "{ESC}"
End If
 
G

Guest

Thanks that helped

Ofer Cohen said:
On the before update event of the check box, you can try this code

If MsgBox("Do you wants to continue?", vbYesNo) = vbNo Then
Cancel = True
SendKeys "{ESC}"
End If
 
M

Marshall Barton

tanhus said:
I wrote this question to in the general questions, it might be appropriate to
write this question in this form:

I have a check box in a form. I want a msg box to pop up everytime it is
clicked on. Asking the user if he/she wants to continue. If user says yes
then the box changes from unchecked to checked or from checked to unchecked.
If user says no then the box stays the same. Im having problems writing the
code for this.


Use the check box's BeforeUpdate event:

If MsgBox("Are you sure?", vbYesNo) = vbNo Then
Me.checkboxname.Undo
Cancel = True
End If
 
G

Guest

Hi Marshall
I tried the Undo method but I got "Method or data member not found", this is
why I used the SendKeys
 
M

Marshall Barton

Ofer said:
Hi Marshall
I tried the Undo method but I got "Method or data member not found", this is
why I used the SendKeys


It works fine for me, Ofer.

Perhaps you used the name of the bound field instead of the
name of the check box???
 

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