View Full Version : VBA SQL Results to Access Report


TallMan
09-03-2010, 11:28 AM
Good Afternoon,

Has anyone ever tried to transfer the recordset from a VBA inscripted SQL statement to an Access report?

Currently I have the query results transfer into an excel spreadsheet. However I would like to "dress" this up a bit and have it transfer/output to a report.

'Send the information to excel on the associates C:drive
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "Main_PIP_TBL_TMP", "C:\Process_PIP.xls", True
'Open Workbook
PIP_Excel.workbooks.Open "C:\Process_PIP.xls"
PIP_Excel.Visible = True

PNGBill
09-03-2010, 01:09 PM
What does your sql do in VBA that it can't do by itself ?

You shouldn't need to export an sql record set to an access report because it can be the record source of the report and is dynamic ie doesn't need to be updated and exported as each time it opens, it is updated.

TallMan
09-03-2010, 01:11 PM
ahhhh....yes. So basically enter the sql code in the report so that when you run it, the report automatically reflects the information the query is pulling.

I believe I understand.

Thanks
PNGBill

PNGBill
09-03-2010, 01:18 PM
Copy the sql and past it in the Record Source property of the report