Solved

Access Report from a Command Line

Posted on 2003-11-30
6
755 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
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 
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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

746 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

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now