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

Print Report From Command Line

Status
Not open for further replies.

MagnusFox

IS-IT--Management
Jan 12, 2001
51
US
Good day,

Let me explain my logic here and you can tell me if it possible.

I have a web application that collects and posts form data to the DB. It then sends an email notification that a new record was added. The email recipient needs to produce a print out of the form data that just came in.

I would like for the email notification to include a 'link' to trigger the printing of the report.

The report is in the DB and printing it as HTML would create formatting issues. That is why I would like to print the report as it exists in the DB.

I would prefer to not have the use go into the DB and search for the record. My email notification would 'know' what record to print.

So, is there a way to trigger the DB to print a report? Remember it will need to send the record ID to the report so it prints the correct record in the report.

Thanks in advance.
 
Pass the Record ID as a Command variable(see /cmd in Access Help).

The link that you would send would be:

"C:\Program Files\Microsoft Office\MSAccess.exe" "C:\Reports Folder\Reports.mdb /cmd "record id"

On the open of the reports.mdb, have a default form open.

In the On Load event of that form, set a text box control equal to the command variable, and then run the report using the record id in the Where clause.

Sub Form_Load

Me![Record ID] = Command
DoCmd.OpenReport "MyReportName" , , , "[Record ID] = '" & Command & "'"

End Sub

You can then place a command button on the form to reprint the report, and another to exit the application.

Good Luck!
Anthony J. DeSalvo
President - ScottTech Software
"Integrating Technology with Business"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top