Results 1 to 8 of 8
  1. #1
    dipitiduda2 is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Jan 2014
    Posts
    28

    Close Subform And Display Newly Added Record On Another Subform

    I have a main form with a subform. On the
    1st subform I'm opening another subform to add a new record. Once I add the new
    record and close the 2nd subform, how do I display the newly added record on the


    1st subform. The 1st subform is currently displaying the last record for that
    primary id but I can't get it to display the new record I just added. Thanks!

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Typically you would requery the subform.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    dipitiduda2 is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Jan 2014
    Posts
    28
    Yes, I tried that on the Load event in the 1st subform - see code below, but it doesn't bring up the newly added record after the 2nd subform closes. Also, on the 1st subform I have set the properties as Filter = Subform's FK; Filter On Load = Yes; Order By = Subform's PK DESC. Not sure why it's not working. Do I need to set the properties back to default so the Me.Requery works?

    Code:
    Private Sub Form_Load()
        Me.Requery
        
        If Not Me.NewRecord Then
            RunCommand acCmdRecordsGoToLast
        End If
        
        Me.cmd_UpdatePFRR.Enabled = False
        
    End Sub

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    If the 1st remained open, that code does nothing; the load event only runs when the form first loads. The requery is meaningless in that event, since the form is just loading its data anyway. I'd requery it from the code closing the 2nd form.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    dipitiduda2 is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Jan 2014
    Posts
    28
    Yes, I did that originally and it didn't change anything. I tried it again before the close code in the 2nd subform and it didn't work this time either. Hmm, I'll just keep working on it till I get it. Thanks for your assistance!

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Can you post the db here?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  7. #7
    dipitiduda2 is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Jan 2014
    Posts
    28
    Sure, let me scrub the data and I'll post it. Thanks!

  8. #8
    dipitiduda2 is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Jan 2014
    Posts
    28

    Close Subform And Display Newly Added Record On Another Subform

    Simply open the dBase, the Navigation form will come up. Click on Adult btn under Manage Programs, click on the PFRRs tab and select any program from the drop down list. Click on the 'add a PFRR...' link to open the 2nd subform and type some data into the form. Click the 'Save PFRR' button. Once the 2nd subform closes the record you just added - see the PK (txtPFRRID) in upper right hand corner of subform and the PK (txtProgramID) of main form - should display in the 1st subform's window.

    This is the issue that I can't seem to resolve - the newly added record on the 2nd subform is not being displayed in the 1st subform's window after it's committed to the dBase.

    Scrubbed dBase_04152014.zip

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

Similar Threads

  1. Replies: 2
    Last Post: 04-04-2013, 05:56 PM
  2. Replies: 7
    Last Post: 11-13-2012, 01:44 PM
  3. Replies: 11
    Last Post: 02-13-2012, 10:06 AM
  4. Replies: 4
    Last Post: 05-17-2011, 06:56 AM
  5. Replies: 5
    Last Post: 06-29-2010, 01:24 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