Answered by:
Print a specific Access Report with selected GridView record

Question
-
User1883103525 posted
I have my code output a gridview with all the data with an option to select records. I'm trying to make a code which would allow me to select a record, and then print this record using a specific Report stored in MS Access.
I've located the code to print the Report it self, but it prints ether all the records or a range.
Any ideas?
Thursday, September 16, 2010 11:36 PM
Answers
-
User-1199946673 posted
I've looked up an article which says it can be donethis example is using office automation, it is recommended not to use that in a web environment:
"Microsoft does not currently recommend, and does not support, Automation of Microsoft Office applications from any unattended, non-interactive client application or component (including ASP, ASP.NET, DCOM, and NT Services), because Office may exhibit unstable behavior and/or deadlock when Office is run in this environment."
http://support.microsoft.com/default.aspx?scid=kb;EN-US;q257757#kb2
But if you use it anyway, realize what your doing. You're opening access on the server(access needs to be installed on it), and you can only print it on a printer that is connected to that server. In your development machine, the server is the same as you client, so it might work, but in a live environment, there's no way to print the report on client side....
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Friday, September 17, 2010 10:07 AM
All replies
-
User-1199946673 posted
Access Reports are not available in a web enivironment, because you don't connect with an Access database but with a Jet Database engine. Only Tables and Stored queries are accessible....
Friday, September 17, 2010 2:56 AM -
User1883103525 posted
I've looked up an article which says it can be done with a few lines as such
Set objAccess = CreateObject("Access.Application") objAccess.OpenCurrentDatabase "C:\Scripts\Test.mdb" Set objCommand = objAccess.DoCmd objCommand.OpenReport "EmployeeList" objAccess.CloseCurrentDatabase
But that only, supposedly, prints the actual report.
I don't need to display it, just pull the report of a specific record and send it to a printer in the background.
Friday, September 17, 2010 9:29 AM -
User-1199946673 posted
I've looked up an article which says it can be donethis example is using office automation, it is recommended not to use that in a web environment:
"Microsoft does not currently recommend, and does not support, Automation of Microsoft Office applications from any unattended, non-interactive client application or component (including ASP, ASP.NET, DCOM, and NT Services), because Office may exhibit unstable behavior and/or deadlock when Office is run in this environment."
http://support.microsoft.com/default.aspx?scid=kb;EN-US;q257757#kb2
But if you use it anyway, realize what your doing. You're opening access on the server(access needs to be installed on it), and you can only print it on a printer that is connected to that server. In your development machine, the server is the same as you client, so it might work, but in a live environment, there's no way to print the report on client side....
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Friday, September 17, 2010 10:07 AM