Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Access Report from a Command Line

Posted on 2003-11-30
6
765 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
Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

 
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 300 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

829 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