469,935 Members | 1,632 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,935 developers. It's quick & easy.

How to pass parameters to Access report via Automation

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
2 2989
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
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.

Similar topics

2 posts views Thread by Tom Weddell | last post: by
6 posts views Thread by Woody Splawn | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.