What is the best way to print a Recordset?

ChampionDuy

Registered User.
Local time
Today, 15:28
Joined
Mar 14, 2002
Messages
94
I have a recordset that displays in a list box and I need that recordset to be printed. What is the best way to go about this?
 
I would go with a report. This is the easiest method for printing. You can create the report off of the same recordset that the listbox is using.
 
Any examples on the code for that. I struggled through creating the recordset and I could use some good examples of code for printing a recordset to a report. I tried a OutPutTo command but that didnt seem to work. Any help would be greatly appreciated.
 
Is your recordset based off of a Query? or an SQL Statement?
 
Use the query as the recordsource for a report.
 
I use the sql statement as the recordsource for the report but the report does not show any data. This is the code that I have producing the report.

DoCmd.Echo False
DoCmd.OpenReport "QryResults", acViewDesign
With Reports("QryResults")
.Visible = False
.RecordSource = lsSQL
End With

DoCmd.OpenReport "QryResults", acViewPreview
DoCmd.Echo True

Where lsSQL is the SQL statement that the user enters. When I look at the properties of the report, the record source does show my sql statement. I dont understand why nothing is showing up on the report. I do a debug.print of my query and it produces the query results in the immediate window. I have to be making a stupid mistake somewhere. Thanks again
 
Brain,

Have you bound the Report Fields to the Fields of the Recordset?
 
no I have not done that, How would I go about doing that since the user enters the query and the fields change every time a user enters a new query.
 
You have just added an other wrinkle that you did not mention earlier. You want an AdHoc Type Report, with custom Columns.

You need to look at using the Docmd.TransferText function.
 

Users who are viewing this thread

Back
Top Bottom