I have a visual basic application which opens an access report based on input parameters. The following code is being used for the same:

dbpath = DATABASE_PATH
Set Acc = CreateObject("Access.Application")
Set DB2 = Acc.Application.DBEngine.Workspaces(0).OpenDatabas e(dbpath, 0, False, ";PWD=xxx")
Acc.OpenCurrentDatabase dbpath, False
Set DB2 = Nothing
Acc.Visible = True
Acc.DoCmd.Maximize
'Open the report with the specified where condition
Acc.DoCmd.OpenReport sReportName, acViewPreview, , where$

I am building the Where condition based on user input in the visual basic form. The form is not in the access project. It is in the visual basic project.

I want to display the values of the parameters on the access report. When i give Forms.Formname.ControlName as the controlsource of the textbox on my report, it gives me a #Name? error.

Pls advise as to how to get the parameters in the 'Where$' condition printed on the report.I am using Visual basic 6 and access 2K. The form is not in the access project.It is in the visual basic application.