getting On lost focus in a continues form

Hello ALL,

i want to trigger an event when going away from a record (to the next record) in a continues form or subform.
Before update doesn't work because many times i'm doing an update on a control even the user is on the same line (record).

On the Forms header we have a On UnLoad event that works fine but not on the details.
Is there a way to know when a user is in subform and going to the next line, i should be able to trigger a function.
I want to able to tell SQL that this record is done and make a copy into a log file (only once)

thanks in advance
LVL 1
frimyAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Lambert HeenanCommented:
Before (or After) Update is certainly where you would do this.  Can you give a little more detail on what you mean by "Before update doesn't work because many times i'm doing an update on a control even the user is on the same line".
0
Gustav BrockCIOCommented:
You can store the ID at the OnCurrent event in a static variable.
When you move to another record, read the value of the variable (the previous ID), do your checks and stuff looking up the previous record in the RecordsetClone of the form, and then store the current ID in the variable:

Static PreviousID As Long

Open in new window

0
Anders Ebro (Microsoft MVP)Microsoft DeveloperCommented:
You wrote
I want to able to tell SQL that this record is done and make a copy into a log file (only once)

The best place to do this is in either the FORMS before update event, or in the AfterUpdate event (depending a bit on what you want)
Both the control and the form have before and after update events.
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

PatHartmanCommented:
The subform's AfterUpdate event is the best choice for this purpose.  If you use the BeforeUpdate event, you may end up logging  record that doesn't actually get saved so you will need a way to get rid of the extraneous log record.
0
frimyAuthor Commented:
Thanks I was able to get around my problem.
0
Gustav BrockCIOCommented:
How?
0
frimyAuthor Commented:
i want to trigger an event when going away from a record (to the next record) in a continues form or subform.
 Before update doesn't work because many times i'm doing an update on a control even the user is on the same line (record).

<< i want to trigger an event when going away from a record (to the next record) >>

the event I meant a trigger in SQL after update.
I created (two switches) an unbound control and a bound control, I set the bound control only when going away from the record.
and in the SQL only to trigger when the bound control is set to 1.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Gustav BrockCIOCommented:
Thanks for the feedback.
0
frimyAuthor Commented:
I already closed this question
0
frimyAuthor Commented:
Thanks I was able to get around my problem.
I already closed this Question
0
PatHartmanCommented:
Why does this person get to award 1000 points to himself?  He never even bothered to tell us what the solution was.  I would rather see the question deleted than to have the OP rewarded for this behavior.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.