Starting a Report

  • Thread starter Thread starter dave h
  • Start date Start date
D

dave h

Hi,

On a form's button click event, I'd like to build an SQL string, marry it
with a report and then fire off the report. I've been trying various
approaches but not having much luck. Can someone provide me with a basic
coding example or point me to a resource that does the same?

Thanks very much - Dave H.
 
A report will expect a specific set of fields. Usually a report is based on
a query which is filtered by a where clause or criteria in the query. Does
this arrangement meet your needs?
 
Hi Arvin,

Thanks, that got me over the first issue. Now, I'm having a problem if I
want the standard Windows printer selection dialog to come up so the user
can choose the printer at run time.

The following code works fine without the .....Printer line - but it only
sends the output to the default printer

Private Sub Report_Open(Cancel As Integer)
Dim mySQL As String
Dim ID As Integer
ID = Reports.Item("report1").OpenArgs
mySQL = "SELECT ......... WHERE ID = " & ID

Reports.Item("report1").Printer ' I'm thinking I need to set some
property, but can't figure out what

Reports.Item("report1").RecordSource = mySQL
End Sub

Thanks, Dave H
 
Back
Top