A little help with events

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

Guest

I have a check box on a form and want to set an event so that when the box is
either checked or unchecked it runs a macro. Would this go in the before
update, after update or ???? Any help would be appreciated.
 
I have a check box on a form and want to set an event so that when the box is
either checked or unchecked it runs a macro. Would this go in the before
update, after update or ???? Any help would be appreciated.

Either the BeforeUpdate or AfterUpdate event should work. BeforeUpdate
is usually used to validate the input, and lets you cancel the update
if there's something wrong; in your case that doesn't apply. You just
want the event to fire when the user updates it.

You could use code like

Private Sub chkMyCeckbox_AfterUpdate()
If Me.chkMyCheckbox
<stuff to do if they checked it>
Else
<stuff to do if it was checked and they unchecked it>
End If
End Sub

John W. Vinson[MVP]
 
I tried the code but it didn't work right, I kept getting a compile error. It
could have been user error. I did figure a way to do it with a conditional
macro, but am unable to figure out a way to send the specific record to an
email recipient. I can get it to send the entire table but not the specific
record set where the change was made. Any suggestions??
 
I tried the code but it didn't work right, I kept getting a compile error. It
could have been user error. I did figure a way to do it with a conditional
macro, but am unable to figure out a way to send the specific record to an
email recipient. I can get it to send the entire table but not the specific
record set where the change was made. Any suggestions??

Correct the error in your code... which I cannot see.

You'll need to use a Query, probably referencing a control on the
form, to select the specific record, but I don't know what the
specifics of the code would be.

John W. Vinson[MVP]
 

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