all groups > sql server programming > august 2007 >
You're in the

sql server programming

group:

Calling an MS ACCESS report from TSQL


Calling an MS ACCESS report from TSQL Harry
8/16/2007 10:34:00 PM
sql server programming:
Hi all
Can any please advise if this can be done and if so were do i start to look.
We have an inventory system that is a MS Access 2003 ADP front end and
SQL Server 2000 Back End we also use scanning software for some business
processes which uses SQL Replication to Push Pull the data between
mobile device database and main database server.
We need to be able to call a MS Access Report from either a SP or Function
can anyone help.

The reason for this request is when the Mobile Device Replicates back to the
main database server triggers are fired for different inventory processes
which of cause does some update around the place.
In the date that is replicated back is two feilds one call Print Labels BIT
and QTY Int

AS a GUI they are using ACCESS 2003 witch houses there reports and there
labels

I need to be able to call the report Labels from the back end as the
replication of cause is automatic. Im happy to do this ineither a sp or a
function or eithen a self made .DLL that i can call from TSQL

It would be nice if i can Pass some parram to but i think im realy pushing
my boundries. But hay why not i suppose the guy who found out the world
wasn't flat said the same thing LOL

I have ask this question in othe DG but have not found anyone who an even
start to suggest how.

I have tried USING XP_CMDSHELL to call MSACCESS with a single test report in
it using a autoexec to fire the report and shut access backdown but it cause
our system to hang, i have check the relevent permisions and they are all
good.



Many thanks in advance
RE: Calling an MS ACCESS report from TSQL Dave Michaud
8/17/2007 7:18:21 AM
I don't understand. Will you be issuing the TSQL commands from the Access
front end? Isn't the user just sitting on an Access form. Can't you just
make a button to open the report.

[quoted text, click to view]
RE: Calling an MS ACCESS report from TSQL Harry
8/17/2007 5:42:00 PM
Thanks Dave for responding

OK, maybe i gave to much information, you never can tell with these things.
Ill try to explain a bit better.

The SHORT answer to your question is NO i wont to issue the TSQL command
from SQL Server 2000 SP.

The information flow goes like this:

we have a mobile device with SQL Server CE Database which replicates back to
SQL server 2000 Database, which then fires a Trigger which has inbeded in it
a Stored Procedure inside that SP i wont to be able to issue a SQL Command
that will either Open MS Access 2003 (Dont care in what state it opens) i
will need to send at least one param two would be good with this way, or is
there a way i can execute (VBA code Module) or Fire a (VBA Code Module)
inside a SQL SP or SQL Function.
Either way i have to just try and find a way to execute a MS Access (Report)
remotely. (No one will see the report you see it is a label templete that
gets sent to the printer that prints labels and the reason i need to send a
Parram is so we can send the identity value (PK) of the product for the label
we wish to print), I may need to do this as a WEB Method and Use OACreate to
ping the webmethod URL. If this is so i will need to find out how i can Do
the same in dot.net 1.1 or 2.0 . Does any no how in C# or VB.net can i call
ms access a fire a report. I hope this explains a bit better what i am trying
to do.

Many thanks
Harry


[quoted text, click to view]
RE: Calling an MS ACCESS report from TSQL Dave Michaud
8/18/2007 7:32:03 PM
Maybe you could do it asynchronously. Your trigger could deposit a record in
a table that an Access macro checks at regular intervals (sleep loop). When
it finds a record, it pulls the parameters, fires off the report, and marks
the record done. You would need to keep access up and running somewhere and
that macro active.

Could you do it without access, and just send a text file to the printer?
You could build a simple bat file to check the table and send the text to the
printer. This could be scheduled via the windows scheduler.

[quoted text, click to view]
AddThis Social Bookmark Button