Subject: DAO and Creating reports
Posted By: geo02mm Post Date: 12/3/2003 1:35:03 PM
I am trying to open an existing report and then save this report with a different name and record source using DAO.  I searched in msdn and various textbooks and it seems that i cannot 'create' new reports using DAO....any help would be appreciated.

Reply By: sal Reply Date: 12/3/2003 1:54:09 PM
I am not sure what you are trying to say.
I use ADO for my reports and it works fine. I do not see why Access would not let you use DAO. Still, I recommend using ADO. It is better.



Sal
Reply By: geo02mm Reply Date: 12/3/2003 2:25:30 PM
Basically what I am trying to do is
a) Open an existing report
b) Save this report with a different name and a different record source.

thus, the reports would be identical except for the name and record source, which would be different.



Reply By: sal Reply Date: 12/3/2003 2:38:36 PM
Are you doing this programatically?



Sal
Reply By: geo02mm Reply Date: 12/3/2003 3:24:11 PM
yes, i'm trying to do this programatically...so far i got the copying report part rigth:

DoCmd.CopyObject , "New report name", acReport, "Old report name"



Reply By: Steven Reply Date: 12/4/2003 6:30:51 PM
Do you really need to copy the report?
Couldn't you just change the recordsource as the report is loading?


I am a loud man with a very large hat. This means I am in charge
Reply By: sal Reply Date: 12/5/2003 9:50:24 AM
To create code to save a report programatically means that you would be doing this a lot for the same report. The report would be saved exactlu tne same as the previous. It would show the same data. Steven is right. Why do you need to do this this way?
At times, programmers say that what they need to do is ... but they forget what the business requirement really is.
Please be more clear on the business requirement of your needs. A simpler solution may exist.



Sal
Reply By: geo02mm Reply Date: 12/5/2003 11:11:32 AM
The requirement is for the user to be able to create and save a report based on an existing one. The report 'format' would be the same, but the record source and hence the data in the report, would be different. So yeah, there would be many reports with the same format but containing different data (ie different Sales managers and sales employees).

Currently there is only one Sales report; so i figure why don't i just copy the existing Sales report, create a new query based on the values the user enters in a form, and then save the report with a different name and with the record source set to the query just created? Maybe I am only seeing it one way, and probably there is a better way to do this....but i don't see it! :)






Reply By: sal Reply Date: 12/5/2003 11:19:56 AM
See, the requirement is to run a report based on different criteria. Create different queries, or delimit them, filter them differently and then you just change the title of the report as needed to describe it's contents. Then from a form have them select the query, recordsource, or parameter of some type. Maybe they can select a title from a dropdown and then this somehow. changes the recordsource and title.

Remember K.I.S.S.

By the way, I am not rude, I just type fast and short. Do not let the used dictate the outcome of your app. They need only define their requirements.

If a user says, I need a report that I can sort and this and that, well, they may just need a form in datasheet view that they can export to excel.

Hope this helps.



Sal
Reply By: geo02mm Reply Date: 12/5/2003 11:37:16 AM
no offence taken :)....That's exactly what i needed: a different way of seeing things! I felt like i was stuck on what i was doing and couldn't think of what to do next....i'll try your suggestion

Thanks Sal




Go to topic 7257

Return to index page 992
Return to index page 991
Return to index page 990
Return to index page 989
Return to index page 988
Return to index page 987
Return to index page 986
Return to index page 985
Return to index page 984
Return to index page 983