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

How to create a report automatically

Status
Not open for further replies.

hasardeux

IS-IT--Management
Aug 10, 2005
4
MA
Hi everybody

I would like to create a report from a query (listbox that lists the whole queries existing) automatically by using a VB code and naming this report by a msgBox.


Thanks
 
Are you asking for someone to help you rewrite all the code from the report wizard?

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]
 
Not all of course.

I'm looking for advices to do it by myself.

But, if somebody had yet the code, why not to share it.

By google search, I have found "CreateReport" method. I used it but it gives an empty report :(

Here's the code from search engine:
-------------------
Sub NewReport()

Set rpt = CreateReport

With rpt
.RecordSource = "Q_PRODUCTS"
.Caption = "R_PRODUCTS"
End With

DoCmd.Restore

End Sub
---------------

Could you help me to do that. Thanks a lot
 
Once you have created a report you can use code to set properties such as Record Source and add controls.

Check out the CreateReportControl method in Help. You may also want to use DAO to get a list of fields from your report's record source.

There are some properties that can only be created while in design view such as sorting and grouping levels.

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]
 
what about autoreport

DoCmd.SelectObject acquery, "querynamefeedfromlistbox", True
DoCmd.RunCommand acCmdNewObjectAutoreport

will prompt you to save on close
 
there are several threads in these (Tek-Tips) which explore the topic sufficiently for most to be able to follow the example and generate a basic report. As a new member, your profile doesn't reveal much about your backround, so if you are not pretty comfortable with programming, you would be better getting some professional help.






MichaelRed


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top