Report based on SQL

johnLH

Registered User.
Local time
Today, 12:32
Joined
Mar 21, 2005
Messages
10
I have a form for users to select various search criteria (name, date range, etc.) This form creates a SQL statement.

What's the best way to run an exisitng report based on this SQL statement?

Any thoughts appreciated.
 
For a similar situation, I use the SQL as an append query (appending to an empty table). Then I simply run the report based on that table and then delete all the records from the table for the next time the report is run.
 
John,

Look in Access Help (and the Search Facility here) for QueryDef.

Base the report on a query, Run your criteria form, Generate the SQL,
Update the report's query, Then run the report.

Wayne
 
Thanks guys

An OpenReport on the search criteria forms OK_click did the business:

Private Sub cmdOK_Click()

Dim strSQL As String

BuldSQLString strSQL
DoCmd.OpenReport "rptMyReport", acViewPreview, , strSQL
DoCmd.Close acForm, Me.name

End Sub
 

Users who are viewing this thread

Back
Top Bottom