Results 1 to 2 of 2
  1. #1
    mkc80 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Apr 2012
    Posts
    56

    DoMenuItem Issue?

    Hi I am trying to enter data via a form which has a save button when clicked should record this entry in the associated table.


    (The record source for the form is the table).

    The problem is, the form is saving only one record, and when I change the values on the form and hit save, it just overwrites the one record in the table.

    Please advise

    This is the code I have for save button:
    Private Sub Command157_Click()
    On Error GoTo Err_Command157_Click




    DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70


    Exit_Command157_Click:
    Exit Sub


    Err_Command157_Click:
    MsgBox Err.Description
    Resume Exit_Command157_Click

    End Sub

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    Form is bound to the table. Data entry/edit is passed directly to the record in table. Data is committed when form is closed or loses focus, move to another record, or execute code. If either of the first two events happen, the third is unnecessary.

    The following will commit the data entry/edit; however, the form focus is still on the record just created/edited:
    DoCmd.RunCommand acCmdSaveRecord

    If you don't want to overwrite values, need to move to a new (blank) record.
    DoCmd.GoToRecord , , acNewRec
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Tab Issue
    By Lazor78 in forum Forms
    Replies: 3
    Last Post: 07-05-2012, 08:18 AM
  2. End if issue
    By raytackettsells in forum Programming
    Replies: 4
    Last Post: 03-22-2012, 10:21 AM
  3. VBA issue
    By manic in forum Programming
    Replies: 4
    Last Post: 02-28-2012, 03:57 PM
  4. VBA Issue
    By MikeDBMan in forum Access
    Replies: 9
    Last Post: 08-02-2011, 03:59 PM
  5. Issue with Do
    By Petefured in forum Programming
    Replies: 1
    Last Post: 05-25-2011, 09:27 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums