pass sql query to report?

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
 
S

Steve Schapel

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top