Results 1 to 6 of 6
  1. #1
    Join Date
    May 2002
    Location
    wakefield, ri
    Posts
    35

    Post Unanswered: Code to Save Record

    Help please for code that will save a data record in a form to the Table on Event BeforeInsert. I want the code to perform the same function as Save Record in the Record Menu.

    Thanks heeps

  2. #2
    Join Date
    Feb 2004
    Posts
    142
    I don' think your question is too clear. The before update event runs just before a record is saved so the process is allready underway.
    KC

  3. #3
    Join Date
    May 2002
    Location
    wakefield, ri
    Posts
    35

    Reply to AZ KC re: Code to Save Record

    BeforeInsert occurs when you type the first character in a new record and before the record is added to the database.

    What I'm trying to accomplish is for the record to save to the table as soon as a user begins entering date into a form.

    Hope this helps - Thanks

  4. #4
    Join Date
    May 2003
    Location
    Dallas
    Posts
    817
    Provided Answers: 5
    this is the code behind the menu item you speak of

    DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
    Dale Houston, TX

  5. #5
    Join Date
    Feb 2004
    Posts
    25
    why not have a [AddNew] command button that does the work and preps the next blank record (CustomerName must allow zero length):

    Private Sub cmsAddNew_Click()
    On Error GoTo Err_cmsAddNew_Click

    RunCommand acCmdRecordsGoToNew
    Me.CustomerName = ""
    RunCommand acCmdSaveRecord
    CustomerName.SetFocus

    Exit_cmsAddNew_Click:
    Exit Sub

    Err_cmsAddNew_Click:
    MsgBox Err.Description
    Resume Exit_cmsAddNew_Click

    End Sub

  6. #6
    Join Date
    Nov 2003
    Posts
    1,487
    DoCmd.RunCommand acCmdSaveRecord

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •