I have a question regarding running an Access Report from VB.NET.


What I want to do is ......

Run a report created in Access from a VB.NET app (which I have done already), but using a paramaterized query.

I can create a Query in Access and asscoiate the report with that query BUT I need to be able to specify the criteria for the query on the fly.


How would I go about that. Like I said, I can set this in the qry builder of access, but I need to change the query search criteria dynamically)

Any help would be greatly appreciated. Details of what I am doing are below to help!!


What I have is this .....
-------------------------------

Below........
ReportQRY is the query I created in Access for testing. The query is as follows (SELECT *FROM historical_places WHERE M_Image_Name='1414'

In the properties of the report I associated the Recordsource Property with ReportQRY

I opened the Query then Opened the report. This works, BUT I just need to be able to run this query on the Report by specifying a value each time for (M_Image_Name) above, and not always keep it at 1414.


CODE
-------

Dim oAccess As New Access.Application
Dim sDBPath As String 'path to Northwind.mdb
Dim sReport As String

' Start a new instance of Access for Automation:
oAccess = New Access.Application

'My report name created within access
sReport = "Community"

'Path to the test Database
sDBPath = "C:\ReportServer\ReportDB\Test.mdb"

'Open the database
oAccess.OpenCurrentDatabase(filepath:=sDBPath, Exclusive:=False)

'Open the query created with MS Access
oAccess.DoCmd.OpenQuery("ReportQRY")

'Run the report (associated with the Query created in Access)
oAccess.DoCmd.OpenReport(sReport)

'Quit access
oAccess.Quit()

'Free
oAccess = Nothing


Many Thanks!!