By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,786 Members | 1,142 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,786 IT Pros & Developers. It's quick & easy.

How to pass parameters to Access report via Automation

P: n/a
I would like to pass multiple parameters from a VB.NET application to an
existing Access 2003 application's reports (essentially using Access as a
report writer where the reports already exist).
The reports' datasource is a stored procedure with multiple @parameters.

This code works where the report requires no parameter:
Dim strAccessDBPath As String
Dim booReturn As Boolean = False
strReportName = "rptCMOTeam1"
strAccessDBPath = "W:\Clinical Services Database\Clinical
Services.ade"
booReturn = OLEPreviewReport(strDB, strReportName)

A Microsoft example shows using a single parameter:
booReturn = OLEPreviewReport(strDB, strReportName),
strWhere:="OrderId = 10251")

Would "OrderId" feed into a @OrderID parameter in a stored procedure, or is
there another way to replace the strWhere clause to feed the @parameters in
the stored procedure?

Thanks,
Dean Slindee
Nov 21 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
This may be possible, I don't know. You could write data to a table in
Access and have the report use the table are criteria for the report...but,
frankly I think this is a bad idea.

Let Access be Access and VB.Net be VB.Net. The is just my opnion however.

"Dean Slindee" <sl*****@charter.net> wrote in message
news:po*******************@fe04.lga...
I would like to pass multiple parameters from a VB.NET application to an
existing Access 2003 application's reports (essentially using Access as a
report writer where the reports already exist).
The reports' datasource is a stored procedure with multiple @parameters.

This code works where the report requires no parameter:
Dim strAccessDBPath As String
Dim booReturn As Boolean = False
strReportName = "rptCMOTeam1"
strAccessDBPath = "W:\Clinical Services Database\Clinical
Services.ade"
booReturn = OLEPreviewReport(strDB, strReportName)

A Microsoft example shows using a single parameter:
booReturn = OLEPreviewReport(strDB, strReportName),
strWhere:="OrderId = 10251")

Would "OrderId" feed into a @OrderID parameter in a stored procedure, or is there another way to replace the strWhere clause to feed the @parameters in the stored procedure?

Thanks,
Dean Slindee

Nov 21 '05 #2

P: n/a
I believe the strWhere part below is the same as the box within Access
where you put the parameter.

A Microsoft example shows using a single parameter:
booReturn = OLEPreviewReport(strDB, strReportName),
strWhere:="OrderId = 10251")

Saying that, I believe something like this would work:
strWhere:="@orderID = value, @param2 = value, @param3 = value, @param4 =
value"

Try what I did above out. If it does not work with the @ signs, remove
and try again. Let us know.

Thanks,

Rocco

*** Sent via Developersdex http://www.developersdex.com ***
Nov 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.