I need a little clarification. It sounds like you have two before update
events. One on the form level (...The check is triggered whenever I move to
a new record.
I have the check in the 'before update event'
....) and one on the click level for you command button (When the user clicks
the 'email' button...This in turn
triggers the 'before update' event.). Is that correct? Or is there just a
before update on the click?
Assuming it is on only the click, you can do a DLookup for the value of the
e-mail on your click event. It would read something like this:
If IsNull(DLookup("emailFlag","table","recordID = " & Me.ID) Then
Send the e-mail
Record e-mail sent
Else
Msgbox that message has already been sent
End If
Just replace the DLookup items with the ones that correspond to your table.
Does that make sense?
--
Regards,
PJ
Please rate this post using the vote buttons if it was helpful.
"Dorian" wrote:
> I have some code which checks if a record has been emailed.
> The check is triggered whenever I move to a new record.
> I have the check in the 'before update event'
> When the user clicks the 'email' button, I have to do a save to ensure any
> pending record changes are saved before I generate the email. This in turn
> triggers the 'before update' event.
> I am then in a situation where the user has clicked 'email' but then
> receives a prompt that he has not emailed yet. I dont want to show the prompt
> if it results from clicking 'email'.
> How can I arrange this better so I don't have this problem? Thanks.
> -- Dorian
> "Give someone a fish and they eat for a day; teach someone to fish and they
> eat for a lifetime".
|