show parameters passed from vb app on access report

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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).OpenDatabase(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.
 
The where$ value can be retrieved in the report from the Filter property.
You could add a text box to your report with a control source of:
Control Source: =[Filter]
This might be a little cryptic for users but should get your started.
 
Thank you for the solution provided. When I do this, I get the whole filter
condition printed on the Report.
For My filter condition appears as follows on the report:
(([TB_Role.Start_date] <= #10/27/2004# and( [TB_Role.End_date]is Null or
[TB_Role.End_Date]>= #10/27/2004#) )and ([TB_Person.Person_id]= 234) )

Is there any way to reference just the values? I mean to say I want only the
Date 10/27/2004 or some other specific condition value like that. How can i
specifically refer to that value?


Duane Hookom said:
The where$ value can be retrieved in the report from the Filter property.
You could add a text box to your report with a control source of:
Control Source: =[Filter]
This might be a little cryptic for users but should get your started.

--
Duane Hookom
MS Access MVP
--

ranimath said:
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).OpenDatabase(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.
 
You could write some code to "parse" out the values from the field names.

--
Duane Hookom
MS Access MVP
--

ranimath said:
Thank you for the solution provided. When I do this, I get the whole
filter
condition printed on the Report.
For My filter condition appears as follows on the report:
(([TB_Role.Start_date] <= #10/27/2004# and( [TB_Role.End_date]is Null or
[TB_Role.End_Date]>= #10/27/2004#) )and ([TB_Person.Person_id]= 234) )

Is there any way to reference just the values? I mean to say I want only
the
Date 10/27/2004 or some other specific condition value like that. How can
i
specifically refer to that value?


Duane Hookom said:
The where$ value can be retrieved in the report from the Filter property.
You could add a text box to your report with a control source of:
Control Source: =[Filter]
This might be a little cryptic for users but should get your started.

--
Duane Hookom
MS Access MVP
--

ranimath said:
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).OpenDatabase(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.
 
Back
Top