Goto New Record

  • Thread starter Thread starter David Whitaker
  • Start date Start date
D

David Whitaker

I am trying to populate ahead 2 new records with

If Me.items = 2 Then
Forms!cpurchase.po = DMax("po * 1", "cpart") + 1
Forms!cpurchase.pofinal = Forms!cpurchase.po & "a"
Forms!cpurchase.posub = 1
Forms!cpurchase.pocount = 2
DoCmd.GoToRecord , , acNewRec
Forms!cpurchase.po = DMax("po * 1", "cpart")
Forms!cpurchase.pofinal = Forms!cpurchase.po & "b"
Forms!cpurchase.posub = 2
Forms!cpurchase.pocount = 2
Exit Sub
End If

but what is happening
when I step into the code it does fine, but when you let it run on its own
it only populates the 1st record as the second record

Where have I gone wrong?
 
Try an explicit save before moving to the new record again, i.e.:
Forms!cpurchase.Dirty = False

If you opened the form as a way of adding the new record, it may be easier
to execute an Append query statement twice.
 
Back
Top