DoCmd.GoToRecord , , acNewRec Problem

S

Silvio

Hello folks, for several reasons, I am using 3 unbounded controls (located in
the heading session of my continuous form) to and new records. The problem I
am having is that occasionally (after entering about 15 records or so)
instead of creating a new record the system overwrite the data in the first
record.
What can cause this sporadic behavior? What can I do to assure that a new
record is created ALWAYS?


If MsgBox("You are about to save a site data verification for site " &
cmbSites.Column(0) & "." & vbCrLf & vbCrLf & _
"Do you wish to continue?", vbYesNo + vbDefaultButton2 +
vbInformation, "Save Record.") = vbYes Then
DoCmd.GoToRecord , , acNewRec
Me.Comment = Me.TxComment
Me.User_ID = DLookup("[User ID]", "[qryCurrentUser]")
Me.Normal = Me.chkNormal
Me.Site_ID = Me.cmbSites.Column(1)
Me.Sonde_ID = Me.cmbSites.Column(4)
Me.Verification_Date = Me.Parent.TxDate
Me.cmbSites = Null
Me.cmbSites.Requery
Me.chkNormal = 0
Me.TxComment = Null
Me.Requery
Me.cmbSites.SetFocus
Else
Exit Sub
 
K

Ken Snell MVP

Try putting this code step after the DoCmd.GoToRecord step:
DoEvents

It will "pause" the code just a bit and let the new record step finish
before you move on.
 

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