VBA - Saving Current Entry ?!?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • shiznaw
    New Member
    • Jun 2007
    • 29

    #1

    VBA - Saving Current Entry ?!?

    Is the following correct?

    DoCmd.DoMenuIte m acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70 ' to save

    DoCmd.GoToRecor d , , acNext ' to auto next

    Me.Requery ' requery for the hell of it


    shiznaw
  • missinglinq
    Recognized Expert Specialist
    • Nov 2006
    • 3533

    #2
    Most people use

    DoCmd.RunComman d acCmdSaveRecord

    now instead of

    DoCmd.DoMenuIte m acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70

    to save a record. The older code is still used by the Command Button Wizard, and still works, but may be phased out in future versions.

    The line

    DoCmd.GoToRecor d , , acNext

    isn't needed to save the record.

    Me.Requery

    will put the new record in its proper place within the recordset, if you will. If records are sorted alphabetically, say, by a person's name, the new record will now be in the correct alphabetical position. If the Requery isn't done, the new record will be at the end of the recordset.

    To sum up,

    DoCmd.RunComman d acCmdSaveRecord
    Me.Requery

    will save the new record and put the new record in its proper place.

    Comment

    • shiznaw
      New Member
      • Jun 2007
      • 29

      #3
      Originally posted by missinglinq
      Most people use

      DoCmd.RunComman d acCmdSaveRecord

      now instead of

      DoCmd.DoMenuIte m acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70

      to save a record. The older code is still used by the Command Button Wizard, and still works, but may be phased out in future versions.

      The line

      DoCmd.GoToRecor d , , acNext

      isn't needed to save the record.

      Me.Requery

      will put the new record in its proper place within the recordset, if you will. If records are sorted alphabetically, say, by a person's name, the new record will now be in the correct alphabetical position. If the Requery isn't done, the new record will be at the end of the recordset.

      To sum up,

      DoCmd.RunComman d acCmdSaveRecord
      Me.Requery

      will save the new record and put the new record in its proper place.
      Thanxs for clarifying. I needed that. so, umm....you guys should start charging!

      shiznaw

      Comment

      Working...