Results 1 to 4 of 4
  1. #1
    mdavid is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Oct 2017
    Posts
    160

    How to open page2 of a tab control with the records created on page1

    Hi, I have 2 pages in a tabControl - Page1 and Page2.
    Each page consists of a form with a subform.
    I have a button on Page1 with onClick code that updates tables that appear in the forms on Page2, after updating the tables I want to automatically open Page2 showing the records that I updated on Page1.
    I tried DoCmd.OpenForm but that opens a separate form - without the records. How would I open Page2 with the updated records?



    Thanks for any help
    David

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    Requery the form on Page2 then set focus to Page2.
    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
    mdavid is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Oct 2017
    Posts
    160
    Hi, Thanks for this.
    I added:

    Code:
           Forms![MempBercMainFrm2].Form![FloraPComplaintWithPreparations].[Form].[RecordSource] = _
                                                     "SELECT * FROM FPComplaintHdr WHERE FdComplaintID = " & newHdrID & " "
           Forms![MempBercMainFrm2].Form![FloraPComplaintWithPreparations].Requery
           Forms![MempBercMainFrm2].[Form]![TabCtl0].Pages(1).SetFocus
    On the code in red I get:

    Run-time Error '424' Object Required

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    This code is behind the main form?

    You want to set RecordSource of a subsubform?

    I always give subform container control a name different from the object it holds, like ctrFlora.

    Me.ctrFlora.Form.ctrSomething.Form.RecordSource = "SELECT * FROM FPComplaintHdr WHERE FdComplaintID = " & newHdrID & ";"

    However, I don't normally set RecordSource if I can help it, I just set Filter and FilterOn properties.
    Last edited by June7; 11-11-2017 at 09:01 PM.
    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. Replies: 9
    Last Post: 10-02-2015, 12:19 PM
  2. Replies: 7
    Last Post: 08-17-2015, 11:52 PM
  3. Replies: 2
    Last Post: 03-13-2015, 07:52 AM
  4. Replies: 1
    Last Post: 11-29-2014, 12:23 PM
  5. Replies: 4
    Last Post: 12-05-2012, 09:20 AM

Tags for this Thread

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