pass sql query to report?

  • Thread starter Thread starter MJ
  • Start date Start date
M

MJ

Hi,

Is there a way to construct the sql query dynamically that I want to
base my report on?

Ie. in my report, I have a sql query that I construct after input from
the user. I want to be able to check and see if they entered anything
in that field and if they did, then I want to include that in the sql
query.

I know how to do the checks on the field and construct the query, but
how do I pass that query to the report? Is that possible?

Thanks,
MJ
 
MJ,

You can set the Record Source of the Report on its Open event.
Dim strSQL As String
strSQL = "SELECT blabla etc..."
Me.RecordSource = strSQL
 
Back
Top