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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Macro to create report

Status
Not open for further replies.

becshu

Technical User
Jan 28, 2003
18
US
Hi,
I want to use VBA to create a report from an existing query. Is this possible? My code already creates a query with a varying number of fields but I'm not sure how to create a report that when opened will be based on the latest version of the query.
Thanks!
 
If you build the report based on the query....every time you open the report it is going to use the "current" version of the query. This is becuase the report source for the report is the query and in order to get the records the report must force the query to run when it opens. So build your report based on your query and then simply use:

DoCmd.OpenReport "reportname", acViewPreview

in the code to open the report.

=======================================
People think it must be fun to be a super genius, but they don't realize how hard it is to put up with all the idiots in the world. (Calvin from Calvin And Hobbs)

Robert L. Johnson III
CCNA, CCDA, MCSA, CNA, Net+, A+
w: rljohnso@stewart.com
h: wildmage@tampabay.rr.com
 
That's what I had done originally, but when I add new fields to my query they are not showing up on the report like I thought they would. Any idea what I'm missing??
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top