'On click' Event

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I want to create a message box with the following message: "Add/Change
record"? I also want the message box to include an 'OK' and 'Cancel' option
buttons. I am not familiar with VBA code so I find the task of writing code
daunting.
I want the message box to execute when the user selects a different name
from a look-up list in a combo box on a form. ('On click' event of the combo
box properties).
Thank you in anticipation.
 
Mark said:
I want to create a message box with the following message: "Add/Change
record"? I also want the message box to include an 'OK' and 'Cancel'
option
buttons. I am not familiar with VBA code so I find the task of writing
code
daunting.
I want the message box to execute when the user selects a different name
from a look-up list in a combo box on a form. ('On click' event of the
combo
box properties).
Thank you in anticipation.

I would use something like this in the Before Update event of the combo:

If MsgBox("Are you sure?", vbYesNo, "Confirm change") = vbNo Then
Cancel = True
Exit Sub
End If

Regards,
Keith.
www.keithwilby.com
 
Thanks Keith for the suggestion. Now, when I select a different name from the
look-up list the message box 'Confirm change' with the 'Yes' and 'No' options
pops up exactly as I want it to do.
However, when I select the 'No' button the name does not revert to the
original name that was there before I selected to change the name. Is there
additional code required here?
 
Mark said:
Thanks Keith for the suggestion. Now, when I select a different name from
the
look-up list the message box 'Confirm change' with the 'Yes' and 'No'
options
pops up exactly as I want it to do.
However, when I select the 'No' button the name does not revert to the
original name that was there before I selected to change the name. Is
there
additional code required here?
I've never been able to bottom that one out. The cancel statement cancels
the change to the combo but the record is still dirty. Pressing ESC clears
it. Maybe someone could jump in with an answer ...
 

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

Back
Top