Vb.net to produce MSaccess report

RIAS
RIAS used Ask the Experts™
on
Hello,
Any Guidline/Suggestion on just a simple system that will produce a printable report using MSaccess instead of sql.
Thanx in advance.

Cheers
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Freelance programmer / Consultant
Commented:
You can use a command line parameter to run a macro in access
https://support.office.com/en-us/article/Command-line-switches-for-Access-558cfe1d-3c98-4292-bee8-1f5df9702bf1

eg. msaccess.exe /ro "c:\MyFolder\MyDatabase.accdb" /x MyMacro

So your macro could print the report then close access after printing.

Author

Commented:
Hello Andy,
Thanks for the input.But ,my client wants a vb.net project to generate MSAccess report.  Any suggestions?

Cheers
AndyAinscowFreelance programmer / Consultant

Commented:
>>my client wants a vb.net project to generate MSAccess report.

If it is to print an existing report the simple suggestion I made will work.  Use a VB.Net app to use Process.Start to launch access with command line parameters.

If it is to create a report you have an incredible amount of code to write, you'd need to open a report in development mode, create and add the data source, add controls to display info where required (header, footer, body, both report and grouping).....
Ensure you’re charging the right price for your IT

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

AndyAinscowFreelance programmer / Consultant

Commented:
ps.  The first only requires the free runtime access on the PC, the second requires the purchased full version of access on the PC.

Author

Commented:
Yes,have purchased access on the pc.
AndyAinscowFreelance programmer / Consultant

Commented:
and creating a report from nothing?

Author

Commented:
yup!
AndyAinscowFreelance programmer / Consultant

Commented:
As I said, loads of work.  How much really depends on just what your client wants.
It is the sort of thing I'd do as a contract job.


you'd need to open a report in development mode, create and add the data source, add controls to display info where required (header, footer, body, both report and grouping).....

Author

Commented:
Ok.
Most Valuable Expert 2012
Top Expert 2014

Commented:
It would be better to create the report in Access and then fill it through automation from your .NET program. Creating a report entirely from code in Access is doable, as Andy said, but it's a tremendous amount of work for no real benefit.

Author

Commented:
Great!Any suggestions on how to add print function for the existing access report.
Most Valuable Expert 2012
Top Expert 2014
Commented:
Are you already interacting with Access from you .NET program? If so, then you would simply call the Access command to print your report:

<YourAccessObjject>.Docmd.OpenReport "YourReportName"

Of course, if you need to filter, or preview, you can include other arguments with that.

If you're not using the Interops method to do this, then as Andy suggested you could use a command line to do this. You'd have to setup a Macro in the Access database to print that report, and then use a commandline like this:

"path to msaccess.exe" /x name_of_your_macro

This will launch an instance of Access and run the commands in that macro.

Author

Commented:
Cheers mates!!!!Will take it from here now..

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial