?
Solved

Access Report from a Command Line

Posted on 2003-11-30
6
Medium Priority
?
785 Views
Last Modified: 2010-05-18
I want to be able to run a report in an access 97 mdb from a command line.
Any suggestions?
0
Comment
Question by:imnotahomey
6 Comments
 
LVL 10

Expert Comment

by:jobrienct
ID: 9848363
not sure, you want to run a report from the command line, does this mean you simply want it to quietly print out your report without bringing up the access interface? or do you mean you want to start access and have it automatically run your report and then exit?

regards,

John
0
 
LVL 8

Expert Comment

by:Benjamin_Luk
ID: 9848439
First create one macro to open your report, then use following command line to open your mdb file , it will run the macroName to open your report:

"C:\Program Files\Microsoft Office\Office\MSAccess.exe" "C:\Program Files\Microsoft Office\Office\Samples\Northwind.mdb" /x MacroName

Best Regards

Ben
0
 

Author Comment

by:imnotahomey
ID: 9848757
Thanks ben!

But what if I need to send some parameters to use for the report in the command line?
0
Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

 
LVL 8

Expert Comment

by:Benjamin_Luk
ID: 9848795
Can not add report parameters in the command line, and you do not need to set it in the command line. If you have set the parameters in your report to let user input, access will pop up the dailog box for user to input the value when you run this command line.

Regards

Ben
0
 
LVL 28

Accepted Solution

by:
TextReport earned 1200 total points
ID: 9849033
If you run a database with a Macro /x MyMacro you can run a function from that macro. In the Function you can use Command$ to return the value from the /CMD parameter from the Command Line

"C:\Program Files\Microsoft Office\Office\MSAccess.exe" "C:\Program Files\Microsoft Office\Office\Samples\Northwind.mdb" /x MacroName /CMD "[MyField]=5"

Function PrintReport
     docmd.openreport "MyReport", , Command$
End Function

and the macro does a runcode PrintReport()

Cheers, Andrew
0
 

Author Comment

by:imnotahomey
ID: 9855157
That's brilliant!
Thanks Andrew!

The reason why I wanting this bizzar task is because users would like an identical report that is in access to be written in oracle reports. They then wanted to call this oracle report from a java application.
Rather than create a new report in oracle (which has not been much success) I wanted to call the report straight from access. I had not found any bridges for java to access so I thought the command line would be the best thing.
Thanks again Andrew!

Boog.

0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
Code that checks the QuickBooks schema table for non-updateable fields and then disables those controls on a form so users don't try to update them.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question