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

Programmatically creating 'dynamic' reports 2

Status
Not open for further replies.

thefoxer

Programmer
Jul 31, 2002
3
GB
I have a report template (header, footers etc) saved as an access report, and I need to add the 'detail' of the report programmatically each time the user selects a bunch of fields from a drop down - basically, a report mail merge(!). Is there a way to open a report object in MS Access and add the controls and bind them to fields the user has selected?

Any help would be seriously appreciated ....
 
Yes there is, but it is a daunting task with limitations. There is a practical number of controls you can add to a Report over it's lifetime, specifically 754 controls, so each time your report is run, any controls you add (even if your delete other controls) will count towards that total. If your report is run daily, you could exceed the total fairly quickly.
Also, the code is very intensive and not all that dependable (at least from my experience.
Let me know what you think.

Paul
 
There is a query by form applet that might meet your requirements at One feature of this applet allows you to create a "merge document" and insert fields from a user-defined list. This is all done in Access.

Duane
MS Access MVP
[green]Ask a great question, get a great answer.[/green]
[red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
[blue]Ask me about my grandson, get a grand answer.[/blue]
 
ACtually, this has been covered in some detail in these fora. While there are some limitations within the smples shown, using 'Search' with keywords [CreateForm | CreateReport] should find several to numerous threads, at least a few of which include complete sample code.





MichaelRed


 
Paul,

[Paul] Many thanks for your reply - The requirement is for the report to be created at each time the report is created, so [from the dta source supplied], the created control limitation you stipulated would not be exceeded at each 'design' stage - your comments are very much appreciated and once aagin i thank you, would you have any further advice?

[Duane] Again, many thanks for the advice, i have already downloaded the sample and will take a look

[Michael] I have tried searching on the 'CreateReport' string you suggested, howver the search has not resulted in any links to threads, any suggestions as i am a 'newbie' to the forum, many TIA ...
 
Just to review your 'search' methods, parameters, fora, etc. A 'quickie' turned up 20+, some uin thius specific forum.





MichaelRed


 
Here's one that uses one of Microsoft's wizards to create a report for you.

Application.Run "acwzmain.auto_entry", "YourTableOrQuery", 1, 3

Note that the last argument indicates Report. The 3rd argument specifies the type of report you want the wizard to create.
 
Another possibility. Use a 'standard' set of fields on the report and change the query it's based on to change the field sources to the user-selected fields.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top