Results 1 to 8 of 8
  1. #1
    Salty Mariner is offline Intermediate
    Windows 11 Access 2021
    Join Date
    Dec 2023
    Location
    Corpus Christi, TX
    Posts
    69

    Post Referencing a subreport on a tab control on a form

    I'm having trouble with referencing a subreport on a tab control on a form.

    The Form's name is frmPortListNew
    the tab control's name is tabPortCalls
    The tab it's on is named Page 51
    the subreport is named rptSubPortList

    My code is as follows



    Code:
    Private Sub cboFind_AfterUpdate()
    Dim intPortID As Integer
    Dim rst As DAO.Recordset
    
    
        intPortID = Me.cboFind.Value
        Set rst = Forms![frmPortListNew]![tabPortCalls]![Page51]![rptSubPortList].Report.RecordsetClone 'Assign the subreports recordsetclone to a vaiable
        
        rst.FindFirst "PortID = " & intPortID   ' find the first match
        
        If Not rst.NoMatch Then 'If a match is found
            [Forms]![frmPortListNew]![tabPortCalls]![Page51]![rptSubPortList].Report.Bookmark = rst.Bookmark 'Set the subreport's bookmark to the recordset's bookmark
        End If
        
    End Sub
    This seems like it should be mundane and simple enough but its throwing a runtime error 451 "Property let procedure not defined and property get procedure did not return an object."

    The syntax for my references appear to be OK. What am I missing.

  2. #2
    Edgar is offline Competent Performer
    Windows 8 Access 2016
    Join Date
    Dec 2022
    Posts
    274
    You do not need to reference tabs or pages, the report is in the form inside a subform/subreport control. You need the name of that control for the syntax to be correct, like:
    Forms![frmPortListNew]![SubreportControlName].Report.RecordsetClone

    You can also simply go to the properties for that report, and set "has module" property to yes in the "other" tab.
    Then, you will be able to forget about any syntax and directly reference the recordset clone property or any other property or method of the report like this:
    Report_rptSubPortList.RecordsetClone
    Please click on the ⭐ below if this post helped you.


  3. #3
    Salty Mariner is offline Intermediate
    Windows 11 Access 2021
    Join Date
    Dec 2023
    Location
    Corpus Christi, TX
    Posts
    69
    Quote Originally Posted by Edgar View Post
    You do not need to reference tabs or pages, the report is in the form inside a subform/subreport control. You need the name of that control for the syntax to be correct, like:
    Forms![frmPortListNew]![SubreportControlName].Report.RecordsetClone

    You can also simply go to the properties for that report, and set "has module" property to yes in the "other" tab.
    Then, you will be able to forget about any syntax and directly reference the recordset clone property or any other property or method of the report like this:
    Report_rptSubPortList.RecordsetClone
    Thank you for the response. I tried your suggestions, and many other variations and I am still not able to refer to the subreport. Something is not right because this should not be this hard. But then again I also have never tried referring to subreports before. That is why did the long form reference figuring that If it was explicitly referenced it should work.

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Only forms have a RecordsetClone because a report's dataset is not editable and editing RecordsetClone data edits the form dataset.

    Also, apparently cannot even set a recordset variable to a report's Recordset - unless you are still working with ADP file.

    Can set recordset variable with report's RecordSource.

    What are you trying to accomplish?
    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
    Salty Mariner is offline Intermediate
    Windows 11 Access 2021
    Join Date
    Dec 2023
    Location
    Corpus Christi, TX
    Posts
    69
    Quote Originally Posted by June7 View Post
    Only forms have a RecordsetClone because a report's dataset is not editable and editing RecordsetClone data edits the form dataset.

    Also, apparently cannot even set a recordset variable to a report's Recordset - unless you are still working with ADP file.

    Can set recordset variable with report's RecordSource.

    What are you trying to accomplish?
    Simple Synchronization is what I was trying to accomplish. I was trying to make it behave like continuous forms. and visually it does. Apparently from what you have just said Navigation/synchronization is not possible. It's not a deal breaker for me by any means. I Have been exploring things like mixing forms and reports and I just learned a big limitation. I can certainly do things more conventionally.

    Oddly, Microsoft Copilot was telling me this was entirely possible, plausible and even offered up several code samples. Go figure.

    Thanks again June

  6. #6
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    I am not understanding what you mean by synchronization and how a RecordsetClone would serve for that.
    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
    Edgar is offline Competent Performer
    Windows 8 Access 2016
    Join Date
    Dec 2022
    Posts
    274
    I just checked and I agree with June7, we have a Recordset property for reports, but it will throw an error if you try to access it. There is no RecordsetClone property available for reports either.

    What kind of synchronization/navigation are you talking about? If you're trying to "focus" on a certain record of the report, you could change the recordsource.
    Please click on the ⭐ below if this post helped you.


  8. #8
    Salty Mariner is offline Intermediate
    Windows 11 Access 2021
    Join Date
    Dec 2023
    Location
    Corpus Christi, TX
    Posts
    69
    Quote Originally Posted by Edgar View Post
    I just checked and I agree with June7, we have a Recordset property for reports, but it will throw an error if you try to access it. There is no RecordsetClone property available for reports either.

    What kind of synchronization/navigation are you talking about? If you're trying to "focus" on a certain record of the report, you could change the recordsource.
    Yes, that is basically all I was trying to do was focus on a record. I can just go back to using a continuous form..... It was interesting to toy around with some different ideas and ways of doing things. Of course i also found out about the limitations Thanks for chiming in. I always learn stuff from you guys.

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

Similar Threads

  1. dCount referencing a control on another form
    By JonathanT in forum Forms
    Replies: 10
    Last Post: 06-14-2020, 10:26 AM
  2. Referencing form name and control in a procedure
    By Jerry Call in forum Access
    Replies: 3
    Last Post: 06-07-2020, 04:45 PM
  3. Replies: 1
    Last Post: 01-10-2020, 05:56 PM
  4. Replies: 3
    Last Post: 02-15-2013, 03:36 PM
  5. Replies: 3
    Last Post: 06-23-2010, 02:02 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