Results 1 to 3 of 3
  1. #1
    Steven19 is offline Competent Performer
    Windows 10 Access 2010 64bit
    Join Date
    Jun 2020
    Location
    London
    Posts
    110

    Form Adding record not Editing

    I have a form issue.



    I have a sub form that, when on its own will let me click the edit button and the appropriate form will come up and the selected record will let me edit it.

    However this form is actually a subform and when it is on the main form. I click that same edit button and instead it desnt edit, but only allows me to add a record.

    I've played with the onclick command and it is presently thus:

    Private Sub Editbtn_Click()
    DoCmd.OpenForm "CompanyDirectorsMultiE", acNormal, , DirectorsofCompanyID = "Me.DirectorsofCompanyID", acFormEdit, , CompanyDDID
    End Sub

    Yet I'm struggling to work out wh.

    The form I'm opening has the following code:

    Private Sub Form_Load()
    Me!CompanyDDID = Me.OpenArgs
    End Sub

    Would you know why when its part of a main record the edit button doesnt upen my form in edit mode the same wayy when it is stand alone?

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,910
    I am confused about what is opening which from where. If you want to provide db for analysis, follow instructions at bottom of my post.
    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.

  3. #3
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,115
    I think you have some issues with the code:
    Code:
    Private Sub Editbtn_Click()
    'DoCmd.OpenForm "CompanyDirectorsMultiE", acNormal, , DirectorsofCompanyID = "Me.DirectorsofCompanyID", acFormEdit, , CompanyDDID
    DoCmd.OpenForm "CompanyDirectorsMultiE", acNormal, , "[DirectorsofCompanyID] = " & Me.DirectorsofCompanyID, acFormEdit, , CompanyDDID
    End Sub
    
    Private Sub Form_Open(Cancel As Integer)
    'openargs available in Open event not Load
    Me!CompanyDDID = Me.OpenArgs
    End Sub
    Is the main form allowing edits (AllowEdits= True)?

    Cheers,
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

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

Similar Threads

  1. Replies: 2
    Last Post: 05-23-2018, 06:56 AM
  2. Replies: 9
    Last Post: 12-01-2015, 10:53 AM
  3. Replies: 7
    Last Post: 02-18-2015, 10:13 PM
  4. Adding/Editing Records through a subform
    By Antinomy in forum Forms
    Replies: 17
    Last Post: 06-30-2012, 07:29 PM
  5. Replies: 0
    Last Post: 10-16-2008, 02:39 PM

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