Results 1 to 8 of 8
  1. #1
    TenOc is offline Advanced Beginner
    Windows 10 Office 365
    Join Date
    Feb 2015
    Posts
    94

    How to refer to a control button on the subform?

    I have a form (call it frmOrdersRead) with four sub-forms with tab format. On one of the sub-forms (call it sfmNotes) there is a control button (call it cobClose) that I would like to hide when the main form frmOrdersRead opens. I’m having problems referring to this control button. I have used the following on the load event of the main form frmOrdersRead with no joy. Any help would be welcome




    Me![sfmNotes].[Form]![cobClose].[Visible]=False


    And also:


    [form]!frmOrdersRead![sfmNotes].[Form]![cobClose].[Visible]=False

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,524
    try w/o the exclamations:
    form!frmOrdersRead!sfmNotes.Form.cobClose.Visible= False

  3. #3
    TenOc is offline Advanced Beginner
    Windows 10 Office 365
    Join Date
    Feb 2015
    Posts
    94
    Quote Originally Posted by ranman256 View Post
    try w/o the exclamations:
    form!frmOrdersRead!sfmNotes.Form.cobClose.Visible= False
    Above did not work

  4. #4
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,793
    Subforms with "tab format"? What does that mean? The subforms are displayed in pages of a tab control? Or is this a navigation form, which AFAIK is the only way subforms themselves can sort of have tabs?
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  5. #5
    TenOc is offline Advanced Beginner
    Windows 10 Office 365
    Join Date
    Feb 2015
    Posts
    94
    Quote Originally Posted by Micron View Post
    Subforms with "tab format"? What does that mean? The subforms are displayed in pages of a tab control? Or is this a navigation form, which AFAIK is the only way subforms themselves can sort of have tabs?
    Seen screen capture below

    Click image for larger version. 

Name:	Tab 2021-11-18_09h44_54.png 
Views:	15 
Size:	69.8 KB 
ID:	46695

  6. #6
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,793
    Sorry, not enough there to tell me if that is a tab control or a navigation form. Maybe show a design view pic, but it has to be bigger than that.
    If you have a navigation form, the syntax you posted won't work. Where the default name for the the subform is used you'd need something like this to get at a control on the loaded form:

    Forms![main navigation form].[NavigationSubform].Form.controlNameHere
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  7. #7
    TenOc is offline Advanced Beginner
    Windows 10 Office 365
    Join Date
    Feb 2015
    Posts
    94
    This may help. The forms name is different that the OP

    Click image for larger version. 

Name:	Tab2 2021-11-18_14h39_11.jpg 
Views:	11 
Size:	156.7 KB 
ID:	46701

    Click image for larger version. 

Name:	Tab 3 2021-11-18_14h42_10.jpg 
Views:	11 
Size:	117.6 KB 
ID:	46702

  8. #8
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,793
    Too bad you didn't show the property sheet with whatever it is that the tabs are on as the selected item. I'd say that's a tab control. It sure isn't a subform control. A subform is just a form that you put in a subform container (subform control). Your form is likely in a subform control that appears on the page. In that case try
    Code:
    Forms!yourMainFormName!yourSubformControlName.Form.yourControlName
    IIRC, a subform control is a child of the form itself, not a child of the page that it is on.

    EDIT
    If the above works using your object names, it means we misinterpreted your design because of terms you used to describe the objects. Might be a good idea to check what the 'selection type' is at the top of the property sheet so that you always get the right term for the object type.
    Last edited by Micron; 11-18-2021 at 03:07 PM. Reason: clarification
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

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

Similar Threads

  1. Refer to control from inside With block
    By pdanes in forum Programming
    Replies: 21
    Last Post: 05-01-2021, 08:25 AM
  2. Replies: 3
    Last Post: 07-14-2015, 12:14 PM
  3. Replies: 2
    Last Post: 11-14-2014, 03:07 PM
  4. Refer to subform name in a module
    By gg80 in forum Programming
    Replies: 11
    Last Post: 04-19-2014, 09:49 PM
  5. Refer to each line of a subform with a query
    By chacenger in forum Queries
    Replies: 3
    Last Post: 01-05-2014, 12:28 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