Results 1 to 5 of 5
  1. #1
    Join Date
    Mar 2004
    Posts
    118

    Question Unanswered: Can I set a Report RecordSource property if i dont know the report name yet?

    Hi,

    I'm trying to make a form that lets you choose which report to run. Unfortunatly im having a bit of difficulty. I can get a named report to open, but I cant set its RecordSource.

    to run the report I'm just doing this:

    DoCmd.OpenReport Me.ReportBox, acPreview

    That seems to work fine, but I'm trying to do this afterwards...

    Reports!("'" & Me.ReportBox & "'").RecordSource = SQL

    Also tried this

    Reports!"[" & Me.ReportBox & "]".RecordSource = SQL

    I'm a code newb, so I'd appreciate a tip on the correct syntanx.


    Thanks

  2. #2
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1
    There is no collection called Reports

  3. #3
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1
    But you can do the following:
    In your report Open event write
    Me.recordSource="SELECT ......"

    OR

    Me.RecordSpurce= Forms("yourFormCallingThatReport").YourTextBox

    Where yourTextBox is a textBox on your Form containing a table or queryName, which should be the RecordSource of your Report

  4. #4
    Join Date
    Mar 2004
    Posts
    118
    Thanks, I did the whole thing in the report.

    The downside is that i need to repeat that for each template.

  5. #5
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1
    Does it function now? Hope yes....

Posting Permissions

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