Affichage des articles dont le libellé est DoCmd.GoToRecord. Afficher tous les articles
Affichage des articles dont le libellé est DoCmd.GoToRecord. Afficher tous les articles

DoCmd.GoToRecord , , acNewRec or Me.Recordset.AddNew ?

vendredi 24 avril 2015

I am curious if there is any major different between using the the two methods.

DoCmd.GoToRecord , , acNewRec
... set form control values
DoCmd.RunCommand acCmdSaveRecord

OR

Me.Recordset.AddNew
... set recordset values here (not sure of the syntax)
Me.Recordset.Update

In particular, I am looking to have a form have a bulk option button where upon clicking the script:
  • stores the values from a couple fields into variables.
  • asks how many new entries to add
    • creates a new record
    • saves the variables to the fields
    • saves the record
    • continues loop until all entries are created.
  • Returns to entry you started at/copied from to finish editing that entry.
Usually the number of entries will be ~5-25. Do they perform the same? Or is DoCmd slower because you are updating all form controls 10+ times, rather than just updating the underlying database records (if that makes sense).
DoCmd.GoToRecord , , acNewRec or Me.Recordset.AddNew ?

Labels