Results 1 to 10 of 10
  1. #1
    MTM is offline Novice
    Windows 10 Office 365
    Join Date
    Apr 2020
    Posts
    20

    Reference to subform in Tabbed form


    I have a subform, BC_MainQry_subform, whose text labels I want to change, located on a Tabbed form. I change the label caption from another form (Admin_Form). I do this by reading a table with the text I want and referencing BC_MainQry_subform with a Call statement to a Public sub:
    Call Change_LblTx("Language_EnglishToChinese", "English", Forms!BC_MainQry_subform)
    This call works if I open only the subform, BC_MainQry_subform, but does not work if I open the Tabbed subform with BC_MainQry_subform. I have tried various ways to change Forms!BC_MainQry_subform to get his to work… but no luck. Anyone have an idea how to change my reference to the subform on the Tabbed form?

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    By tabbed subform do you mean a Tab control or a Navigation Form?

    Tab control is irrelevant when referencing subforms.

    In either case, subform must be referenced through subform container control. On a Navigation Form Access defaults to [NavigationSubform] as container name.

    Is the subform located on Admin_Form?
    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
    MTM is offline Novice
    Windows 10 Office 365
    Join Date
    Apr 2020
    Posts
    20
    Thank you for your comment. No, the subform is located on the Tabbed control. The tabbed control is located on the 3rd tab of a Form called Basecoat. The Basecoat form is located on a Navigation Form.
    To make things simpler, I can put buttons on the Basecoat form instead of a separate Admin_Form... maybe this makes referencing to BC_MainQry_subform less complicated.

    Mike

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    You have Basecoat in a Navigation Form and then you have a Tab control on Basecoat? Then BC_MainQry_subform is on Tab control?

    As is, I think reference would be like: [Forms]![Navigation Form]![NavigationSubform].Form.BC_MainQry_subform!labelname.Caption

    That assumes you keep the default names [Navigation Form] and [NavigationSubform] that Access assigns and that BC_MainQry_subform is name of 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.

  5. #5
    MTM is offline Novice
    Windows 10 Office 365
    Join Date
    Apr 2020
    Posts
    20
    Thank you for your help. So far, though, no success.
    I have simplified the problem as follows:
    I placed a button on the Tabbed control Page where the subform is that I want to manipulate. I can not place the button on the form itself because the form view needs to be datasheet... buttons do not show.

    The Form with Tabbed control is "Basecoat_Tabbed", with 3 Tabs. The form to manipulate is on page index 2. The form I want to manipulate is "BC_MainQry_S_Test" on page index 2. I don't think it matters that I am not referencing the page in my call... but?

    From the button located on Tabbed index page 2, I make my call, Call Change_LblTx("Language_EnglishToChinese", "Chinese", Forms!BC_MainQry_S_Test), I get the message that Access can not find the referenced form BC_MainQry_S_Test.

    It should not be this difficult... How do I determine correct referencing? I have seen tables about this, but they all refer to some attribute... I am just wanting to pass the form name as a form.

    Mike

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    My suggestion works for me.

    As already stated, Tab control is irrelevant. Are you using a Navigation Form?

    I never use Navigation Form.

    Can make a form in Continuous View look like Datasheet.

    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.

  7. #7
    MTM is offline Novice
    Windows 10 Office 365
    Join Date
    Apr 2020
    Posts
    20
    do you see any problem with my referencing, Forms!BC_MainQry_S_Test, in the call below? I get the message that Access can not find the referenced form BC_MainQry_S_Test.

    Mike

    From the button located on Tabbed index page 2, I make my call, Call Change_LblTx("Language_EnglishToChinese", "Chinese", Forms!BC_MainQry_S_Test), I get the message that Access can not find the referenced form BC_MainQry_S_Test.

  8. #8
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    That is not correct. Must reference subform container control that holds the form. I always name container different from the form, like ctrTest. So, if container and form have same name and not a Navigation Form, options:

    1. full path reference:
    Forms!Basecoat_Tabbed.BC_MainQry_S_Test!labelcontr ol.Caption

    2. path with Me alias:
    Me.BC_MainQry_S_Test!labelcontrol.Caption
    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.

  9. #9
    MTM is offline Novice
    Windows 10 Office 365
    Join Date
    Apr 2020
    Posts
    20
    June7, Thanks for your help... finally solved the problem

    Forms!Basecoat_Tabbed.BC_MainQry_S_Test!labelcontr ol.Caption does not work

    Forms!Basecoat_Tabbed!BC_MainQry_S_Test.Form does work!

    I was not trying to reference a control parameter... I needed to pass the Form information... I found how to refer to the form as an Object by removing the control reference and adding .Form

    I think the whole business of referencing is not well addressed by Microsoft.

    Mike

  10. #10
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Sorry, I missed that you wanted the form, not a field/control on form. Point was, had to reference container control first. Glad it's working.

    Another version of referencing controls:

    Me.BC_MainQry_S_Test.Form.labelcontrol.Caption
    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. Tabbed Subform - Form Properties
    By crhaines94 in forum Forms
    Replies: 21
    Last Post: 01-22-2019, 03:25 PM
  2. Replies: 1
    Last Post: 10-06-2015, 06:50 AM
  3. Reference Subform on Navigation Form
    By GOP in forum Forms
    Replies: 1
    Last Post: 07-30-2014, 08:18 AM
  4. Subform Refresh in a Tabbed Main Form
    By theosgood in forum Forms
    Replies: 5
    Last Post: 06-22-2012, 10:12 AM
  5. form/subform reference problem
    By dbertanjoli in forum Forms
    Replies: 1
    Last Post: 01-10-2011, 03:31 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