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

Dynamic report from DAO recordset 1

Status
Not open for further replies.

shadylane

Programmer
Jan 23, 2003
21
JP
Hi All,
Is it possible to just dump a DAO recordset into a report and have it displayed in a tabular format?
The field names and order varies depending on the recordset, so the number of columns could vary from 6 to about 35.
Alternatively, just dumping the recordset into Excel would be OK.
(I'm sure this has been answered before somewhere but the keyword search seems to be being repaired).
Thanks so much.
Greg
 
Hi

There are various DoCmd methods which may help you eg

DoCmd.TransferSpreadsheet
DoCmd.OutputTo

to put recordset into spreadsheet

Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
I tried those commands, but it seems that you have to specify a table or a query as one of the arguments. However in this case, the SQL string is created dynamically and then used to open a DAO recordset - so it doesn't seem like I can use it.
Do I need to use a recordset for this? Can I just set the SQL string as the source for a report or whatever?
(We're talking a report that is completely empty and has no set record source)
Am I missing something here?
Thanks
Greg
 
Hi

Even although you create the SQL string in code, you could still use a 'saved' query, just used the querydef object and .SQL property to set the dynamic SQL string you have build into the querydef, then you can run it via the command I mentioned Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top