Event not triggering until you do it again

Shop Girl

Registered User.
Local time
Today, 23:17
Joined
Sep 2, 2002
Messages
18
I have an Append query that is triggered through a macro when you exit a field on a subform.

Trouble is that it just doesn't run when you first enter the data.

To get it to run, I have to leave the row and then overtype what I did!

Anyone got any ideas as to why - I've tried it on After Update, On Change, Lost Focus, On Exit.

My query is called Samples Query. Would it be better to write code to do it?

Thanks for any help/advice you could give.
 
In the On Exit or After Update event of your field (your choice as when you want to trigger the code) try code like this:

Double click on the event you want and [Event Procedure] should appear in the field next to the event name. Click on the button with 3 dots to the right of the field to open the code page. The cursor will be flashing between two lines of code. Put in code like this:

DoCmd.SetWarnings False
DoCmd.OpenQuery "Samples Query"
DoCmd.SetWarnings True

The SetWarnings turns off the message that you are about to Update a record and do you want to do that. You may not add those two lines of code until you are sure your code is working the way you want.

hth,
Jack
 
Thanks!

Thank you both for your help!

You are right Pat - can't believe I missed that one!

Anyway it's all working fine now.

Thanks once again to this forum!

:D
 

Users who are viewing this thread

Back
Top Bottom