Results 1 to 4 of 4
  1. #1
    virgilio is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Nov 2019
    Posts
    40

    Referencing a control in a subform from parent

    Hi, How do I reference a control on a subform? This is my form (Its a work in progress):

    Click image for larger version. 

Name:	Forum_subform_control.PNG 
Views:	6 
Size:	17.3 KB 
ID:	42538

    The subform is the continuous form set below the "Report Viewer" Bar. I would like to press the "COM" to set a variable equal to the value of the unbound combo-box with the "Lot Number" label.



    This is what I have tried to do:

    Code:
    Private Sub updateVars()
       Dim LotFilter As Variant
       
       LotFilter = Forms.Parent_Form.Child_Form.LotFilter
       
    End Sub
    And this updateVars function is called from the Form Open event.

    The error message is "Object doesn't suppor this property or method"

  2. #2
    Bob Fitz is online now Access Developer
    Windows 10 Access 2016
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    2,507
    Why use a form on a report. Why not create a report that can be used as a subreport.
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  3. #3
    virgilio is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Nov 2019
    Posts
    40
    Hi Bob,

    I'm letting my users filter by the controls on the form, and generating the report from the filter string that is generated by using the controls like "LotFilter" and "Spec Description Filter" and "Lot Status". These controls create a query string that is used to control what is displayed in the continuous form, but the same string is also used to create a report or excel export.

    This works well on the main page, but its getting crowded, so I'm trying to move this functionality to a pop up form (pictured in the OP). The main page has all of the controls in the header of the subform, I just want to put the buttons on the side for aesthetics.

  4. #4
    virgilio is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Nov 2019
    Posts
    40
    Ok,

    I got past this with the following code:

    Code:
    Private Sub updateVars()
         
       LotFilter = Nz(Forms!Reports_Form!Reports_Subform!LotFilter, "")
       
    End Sub
    Thank you to everyone who looked at this.

    Reports_Subform = the name I gave to the subform in the properties window.
    Reports_Sub = the name that I used previously. This is what that sub is called in the Access Objects list on the Left. (Not used, this is what my problem was)
    Reports_Form = the name of the parent form from the Objects list on the left. There is no name in the properties window to use in its place.

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

Similar Threads

  1. referencing to a control property on a subform
    By markjkubicki in forum Programming
    Replies: 6
    Last Post: 06-08-2020, 08:39 PM
  2. Replies: 3
    Last Post: 04-17-2019, 04:47 PM
  3. Replies: 3
    Last Post: 12-06-2018, 03:27 PM
  4. Replies: 6
    Last Post: 11-20-2014, 03:37 PM
  5. Replies: 6
    Last Post: 02-23-2014, 05:53 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 - Senior Forums