DoCmd.GoToRecord

D

dshemesh

Hello,
I'm using the code line: DoCmd.GoToRecord , , acPrevious (OR
DoCmd.GoToRecord , , acNext) In a few forms in my program.
The thing is that in a few forms this command automatically takes me to the
Form_BeforeUpdate() method (and afterwards to the Form_Current() method), and
in other forms it goes straight to the Form_Current() method, and never gets
to the Form_BeforeUpdate() method.
Why does this difference occur and how can I avoid it?
Thank you.
 
A

Allen Browne

Form_BeforeUpdate fires if the form is dirty (i.e. only if it needs to save
the record).

You can force the record save before you try to move, with:
If Me.Dirty Then
Me.Dirty = False
End If
 
D

dshemesh

Thank you.
I've noticed that one of my forms is dirty as soon as it opens. What may be
the reason for that? I don't change any property on the Form_Open() or
Form_Load() methods...
 
A

Allen Browne

Anything in the form's Current event that is assigning a value to a bound
control?
 

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

Top