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

    Question Unanswered: Can I use a recordset to set RecordSource value?

    I have 5 Identical databases, but for 5 different projects.

    I'm trying to write a reporting utility that allows you to report on all of them. But instaid of having 5 x 3 Reports I just want a little filter that lets you choose which database your going to be using.

    I know how to do this using code, just sticking SQL directly into RecordSource of a report.

    But I want to be able to have visual queries for the user.

    I know thers a way i can make a little table with project ID and corresponding query in it, but i have no idea how to use that and link it to the RecordSource.

    Do I need to use recordset?

    Say I have Databases A,B,C and G(for general). I want to make the queries, all 15 of them... And have a table with 15 records....

    Edit: I said 5 databases because the 5th is early works, just basically a union between all of them...

    Is there a way to just change the RecordSource using that table?
    Last edited by YevSnow; 04-22-04 at 10:07.

  2. #2
    Join Date
    Feb 2004
    Location
    CT,USA
    Posts
    250

    Re: Can I use a recordset to set RecordSource value?

    Originally posted by YevSnow
    I have 5 Identical databases, but for 5 different projects.

    I'm trying to write a reporting utility that allows you to report on all of them. But instaid of having 5 x 3 Reports I just want a little filter that lets you choose which database your going to be using.

    I know how to do this using code, just sticking SQL directly into RecordSource of a report.

    But I want to be able to have visual queries for the user.

    I know thers a way ...
    Why not have 5 similar tables (w/ same structure) different names and a form that handles the visual queries using grouped check boxes? In your after update sections for your txtboxes & grouped chk boxes you go to a common sub where you modify the record source and/or filter to modify the SQL in VB behind the scenes.
    HTH

  3. #3
    Join Date
    Feb 2003
    Location
    Wichita,KS
    Posts
    44
    I use one report for multiple queries every chance I get. Saves making the same changes many times.
    You could try something like this.
    Code:
    Private Sub Report_Open(Cancel As Integer)
       If Forms![Print Reports]![Report to Print] = 4 Then
          Me![txtHeader].Caption = "NEW HEADER"
          Me.RecordSource = "NEW QUERY NAME”
          End If
    Exit Sub
    End Sub

Posting Permissions

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