I often use the following code to successfully run Access queries in VB:

strParam = "PARAMETERS [paramName] TEXT; "
strSQL = dbData.QueryDefs("queryName").SQL
Set qdf = dbData.CreateQueryDef("", strParam & strSQL)
qdf("paramName") = textfield
Set rs = qdf.OpenRecordset(dbOpenSnapshot)

Does anybody know of anything similar to run an Access report, based on a query that takes a parameter.

Note that I am trying to avoid the situation where I have to open the Access application. I don't want to have to do:

Set acc = New Access.Application
acc.DoCmd.OpenReport rptName, acViewNormal

because this gives me other problems.

I am using VB6, Access 97, Jet/DAO.

Thanks in advance.


[This message has been edited by Michael (edited 06-24-1999).]