Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2003
    Location
    Plymouth, UK
    Posts
    59

    Question Unanswered: On click event to select record source??

    I am wondering is instead of having 10 querys and 10 relevent reports built in Access, can I have a template Report which on a specific button on click event would say open template report and change record source to query 1, or query 2 etc, which ever was relevent, could someone tell me if this is possible and if so an idea of the VB code required?

    Kind regards,

    Dave

  2. #2
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Hi

    I think I looked at this in the past but as soon as I started thinking about groupings etc it started getting a bit complicated. It seemed easier to produce different reports than to try to produce a "template" and figure out how to get each different report to work. Anyway, if you have thought it through better than me, I was thinking of the click event opening the report in design view, add the record source string to the Tag, and then open acPreview. Have the report's on open event contain something like me.recordsource = me.tag. Alternatively, if you would always open from the same form use an invisible text box on the form that contains the record source. me.recordsource = forms!FormName.txtRecSrc

    Actually, just realised the above has too many stages. Open the report in design, set the record source to your desired query, then open. No need to use the tag.

  3. #3
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    What exactly do you need to do? Perhaps you would be best served by a parameter query? If the "template" of the report remains unchanged, as in all of the controls are in the same place and no physical changes occur, then you may be able to get by using just a parameter report instead of rebuilding your datasource from scratch every single time.

Posting Permissions

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