Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Create Report Method and recordsource

Status
Not open for further replies.

cdw0308

Technical User
Oct 8, 2003
181
US
I am trying to get the create report method to work but so far i have had little luck.

here is what i have so far:

Private Sub Form_Close()
Dim rpt as report
set rpt = CreateReport( , Proj_Temp)

strSQL = "SELECT item_num, name, quantity FROM Project"
DoCmd.Openreport Proj_Temp, acViewPreview
Reports!Proj_Temp.RecordSource = strSQL

End Sub

It is ran when i close a form. I want it to create a report based on the report template that i have created (Proj_Temp). So far it creates a blank empty report. I need it to open the template report and set the recordsource.

It is also giving me a run-time error 2497 "action or method requires a report name arguement" and it highlights the docmd.openreport part of the code above.

I may have some things not in the right place. I would appreciate any suggestions.

cdw
 
I have gotten it to bring up the template report (Proj_Temp)
But i am still having problems assigning it a recordsource.
I think their may be a problem with my recordsource statement.

Here is what i have so far.

Private Sub Form_Close()
Dim stdocname As String
stdocname = "Proj_Temp"

DoCmd.OpenReport stdocname, [acViewPreview]
strSQL= "SELECT item_num, name, quantity FROM Project"
Report.Proj_Temp.RecordSource = strSQL

any ideas?


End Sub



strSQL = "SELECT item_num, name, quantity FROM Project"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top