Results 1 to 14 of 14
  1. #1
    2 Star Lounger
    Join Date
    Oct 2001
    Location
    Suffolk, England
    Posts
    134
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Report, Record Sources (Access 2000)

    I am having trouble changing from Access 97 - Access 2000.
    I have a Master report with several sub-reports on it. I want a copy of it with the subreports referencing a different query. Why doesn't the statement 'Me!RptMedical.RecordSource = "QryMedClin"' work. RptMedical is thename of the subreport and QryMedicalClin is ithe name of the query I want it to reference. It produces the error message 'Object doesn't support this property or method!. However it works in Access97!.
    Allison

  2. #2
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: Report, Record Sources (Access 2000)

    Hi Alison,
    I thought the syntax was 'Me.Recordsource="QryMedicalClin".

    You mention the name of the query in two places but with different names, QryMedicalClin and QryMedClin. Which one is it?

    Where have you got the statement? It should probably be in the Form_OpenEvent.

    HTH
    Pat

  3. #3
    2 Star Lounger
    Join Date
    Oct 2001
    Location
    Suffolk, England
    Posts
    134
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Report, Record Sources (Access 2000)

    Sorry, the name of the Query is QryMedClin.
    the statement is in the Report-Open Event of the Parent report and RptMedical is the subreport whose record source I want to change

    Allison

  4. #4
    Star Lounger
    Join Date
    Mar 2001
    Location
    Dudley, Midlands, England
    Posts
    55
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Report, Record Sources (Access 2000)

    RecordSource is a property of a sub-report, not of a sub-report control. So from the main report you need to set Me!RptMedical.Report.Recordsource = "QryMedClin".

    Simon.

  5. #5
    2 Star Lounger
    Join Date
    Oct 2001
    Location
    Suffolk, England
    Posts
    134
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Report, Record Sources (Access 2000)

    I must be dim, but I'm now getting the error 'You entered an expression that has an invalid reference to the property Form/Report'
    Everything is spelt correctly.
    Allison

  6. #6
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Report, Record Sources (Access 2000)

    In Me!RptMedical.Report.Recordsource, RptMedical has to be the name of the subreport control, not the name of the report in the database window.
    Francois

  7. #7
    2 Star Lounger
    Join Date
    Oct 2001
    Location
    Suffolk, England
    Posts
    134
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Report, Record Sources (Access 2000)

    It is!

    Allison

  8. #8
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Report, Record Sources (Access 2000)

    What if you set :
    Me.Recordsource = "QryMedClin"
    in the on open event of the subreport ?
    Francois

  9. #9
    2 Star Lounger
    Join Date
    Oct 2001
    Location
    Suffolk, England
    Posts
    134
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Report, Record Sources (Access 2000)

    But I really wanted to keep all the sub reports the same and make them reference different data sets depending on which Parent report is opened - I need some sort of statement like
    If Me.Parent = "RptAnalysisClin" Then
    Me.Recordsource = "QryMedClin"
    End if
    Which Access treats as rubbish (wrong number of arguments)
    Allison

  10. #10
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Report, Record Sources (Access 2000)

    I have been searching the KB from MS and found this article.
    It says
    <hr>You can set the RecordSource property of a subreport from its OnOpen event at run time only. At all other times, this property is read-only and cannot be modified. <hr>
    I think it must be possible to refere to the parent to change it from there. If you attache the mdb with sample data, maybe we can look at it and help further.
    Francois

  11. #11
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Report, Record Sources (Access 2000)

    Another possibility would be to make different subreports and change the sourceobject of the subreport control. That's working, I just try it.
    Me.RptMedical.SourceObject = "Report.OtherReport".
    Francois

  12. #12
    2 Star Lounger
    Join Date
    Oct 2001
    Location
    Suffolk, England
    Posts
    134
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Report, Record Sources (Access 2000)

    Thanks for taking the time to look for me.
    I attach a much cut down version of the mdb. The report I am tring to create a copy of is called RptAnalysisClin. It has a lot of sub reports but I have just left 3 on it. It is these sub reports that I want to stay the same but with a different query as the control source. When the Form asks you to select a Directorate - leave it blank.

    Allison
    Attached Files Attached Files

  13. #13
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Report, Record Sources (Access 2000)

    Allison,

    Here is the modified mdb.
    I have create rptOther, it's just a copy of RepAnalysisClin.
    I have modified RptA&CClin and add a select case in the on open event:
    <pre>Select Case Me.Parent.Name
    Case "RepAnalysisClin"
    Me.RecordSource = "QryA&CClin"
    Case "RptOther"
    Me.RecordSource = "QryOtherPayClin"
    End Select</pre>

    This seems to work. Can you check it ?
    Attached Files Attached Files
    Francois

  14. #14
    2 Star Lounger
    Join Date
    Oct 2001
    Location
    Suffolk, England
    Posts
    134
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Report, Record Sources (Access 2000)

    That's BRILLIANT
    Thank you very much

    Allison

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •