Results 1 to 6 of 6
  1. #1
    megatronixs is offline Advanced Beginner
    Windows 8 Access 2013
    Join Date
    Jul 2015
    Posts
    91

    subform used in 2 forms

    Hi all,



    I have an audit trail subform that I used first in one form. Now I need to use it in a second form as I have a version with limited things for other users.
    these are the 2 forms: "frm_admin_analyst" and "frm_admin_main" the audit trail form: "frm_AuditTrail_subform"
    the load event of the "frm_AuditTrail_subform"
    Code:
    Option Compare Database
    Private Sub Form_Load()
        
        Me.Filter = "[tblAuditTrail].[RecordID]=[Forms]![frm_admin_main]![record_id]"
        Me.FilterOn = True
    End Sub
    Is it possible to make them both use the same audit trail form?

    Greetings.

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,931
    Why do you need to use code to set Filter property of frm_AuditTrail_subform? Are you using the Master/Child links properties of the subform container control?
    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
    megatronixs is offline Advanced Beginner
    Windows 8 Access 2013
    Join Date
    Jul 2015
    Posts
    91
    Hi June7,

    It does not work. I keeps asking to put in the ID nr and then it will connect just fine the correct record.
    Is it maybe because I did copy the form and then did rename it?

    Greetings.

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,931
    Don't really understand what you mean. You say it does not work then say it connects just fine. What does copying form have to do with setting the Master/Child Link properties?
    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.

  5. #5
    megatronixs is offline Advanced Beginner
    Windows 8 Access 2013
    Join Date
    Jul 2015
    Posts
    91
    hi June7,

    When I open the form, the code from the first post will check which record I have selected and pass it to the subform to show those records that are connecte via the record_id.
    but it does not do it, instead I get a small box poping up asking me the record_id, when I type in the one I try to open, then it will pop up the right record.
    I have simply 2 forms that have the same subform in them. One of the form just opens correctly with the record_id and the second form just ask for the record_id (like a parameter query)

    Greetings.

  6. #6
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,931
    I don't understand this setup. If you are using subform, why do you need code and not just use Master/Child Links properties? 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.

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

Similar Threads

  1. forms and subform
    By edwardcga in forum Forms
    Replies: 4
    Last Post: 11-26-2013, 11:45 AM
  2. Subform with multiple parent forms
    By mwc0914 in forum Forms
    Replies: 8
    Last Post: 03-12-2013, 06:17 AM
  3. 2 Forms and 1 subform
    By Joe8915 in forum Forms
    Replies: 3
    Last Post: 12-06-2012, 01:03 PM
  4. 2 forms and one subform update
    By jwd in forum Forms
    Replies: 6
    Last Post: 11-20-2012, 07:08 PM
  5. Replies: 3
    Last Post: 04-17-2012, 10:28 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