Passing arguments to .adp report with stored proc from vbscript

B

Buddy G

I would like to use vbscript to call up a report in an access .adp where the
report uses a stored procedure in a sql server 7 table that accepts two
input parameters.

The following script is what I have so far: (And I'm not a programmer!)

Dim oAccess, sDbName, sRptName
sDbName = "\\sbs\Company\test.adp"
sRptName = "Slide Labels"

Set oAccess = CreateObject("Access.Application")

With oAccess
.visible = True
.OpenAccessProject (sDbName)
.DoCmd.OpenReport sRptName, 2
End With

Set oAccess = Nothing
-------------------------------

There are several problems with this.

1) I have to use .visible = true. This is so that the dialog asking for the
SQL server SA password will appear. Otherwise, the OpenReport statement
fails because the stored proc data source is unavailable to the report.

I can't see how to use a DAO type connection string here.

2) After the SQL login dialog pops up, the dialogs for the two parameters to
the stored proc pop up. When the report runs, the constant "2" calls up
preview mode.
In Access 2002, preview will come up. I can preview the report, then either
print or close the report. Then the Set oAccess = Nothing closes everything.
If I use "acViewPreview" in place of it's constant "2", then the preview
immediately dissappears as the Set oAccess = Nothing line executes right
away.
In Access 2000, the Set oAccess = Nothing executes right away no matter what
preview statement is used.

I need some suggestions on keeping the application open until the user has
previewed / printed the report.

3) I can't find anything in help or google search about how to pass the
values to the stored proc from the script.

Any comments or help is greatly appreciated.
Thanks, Buddy
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top