AfterInsert problem

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

Guest

I have an AfterInsert procedure that assigns values to several fields (not form controls) before the new record is complete. The user should only have to click once on the right arrow navigation bar to move to the next blank record. But nothing happens on the first click. It takes two clicks to move on. However, if I comment out the AfterInsert procedure, the user only has to click once as expected. Anyone know why this is happening and how to correct it

ctda
 
Move the code into the form's BeforeUpdate control so that you are not
dirtying the form again immediately after the new record saves:

Private Sub Form_BeforeUpdate(Cancel As Integer)
If Me.NewRecord Then
'Do your stuff in here.
End If
End Sub

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

ctdak said:
I have an AfterInsert procedure that assigns values to several fields (not
form controls) before the new record is complete. The user should only have
to click once on the right arrow navigation bar to move to the next blank
record. But nothing happens on the first click. It takes two clicks to
move on. However, if I comment out the AfterInsert procedure, the user only
has to click once as expected. Anyone know why this is happening and how to
correct it?
 
Thanks very much. This will do the trick for me
ctda

----- Allen Browne wrote: ----

Move the code into the form's BeforeUpdate control so that you are no
dirtying the form again immediately after the new record saves

Private Sub Form_BeforeUpdate(Cancel As Integer
If Me.NewRecord The
'Do your stuff in here
End I
End Su

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.htm
Reply to group, rather than allenbrowne at mvps dot org

ctdak said:
I have an AfterInsert procedure that assigns values to several fields (no
form controls) before the new record is complete. The user should only hav
to click once on the right arrow navigation bar to move to the next blan
record. But nothing happens on the first click. It takes two clicks t
move on. However, if I comment out the AfterInsert procedure, the user onl
has to click once as expected. Anyone know why this is happening and how t
correct it
 
Back
Top