A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Setting Up & Running Reports
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

show parameters passed from vb app on access report



 
 
Thread Tools Display Modes
  #1  
Old October 26th, 2004, 01:07 PM
ranimath
external usenet poster
 
Posts: n/a
Default show parameters passed from vb app on access report

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.
  #2  
Old October 26th, 2004, 03:54 PM
Duane Hookom
external usenet poster
 
Posts: n/a
Default

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" wrote in message
...
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.



  #3  
Old October 27th, 2004, 06:47 AM
ranimath
external usenet poster
 
Posts: n/a
Default

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" wrote:

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" wrote in message
...
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.




  #4  
Old October 29th, 2004, 03:35 AM
Duane Hookom
external usenet poster
 
Posts: n/a
Default

You could write some code to "parse" out the values from the field names.

--
Duane Hookom
MS Access MVP
--

"ranimath" wrote in message
...
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" wrote:

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" wrote in message
...
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.






 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Images in a database Franz General Discussion 10 October 7th, 2004 09:35 AM
"Between" "and" parameters access. How? rleblanc New Users 5 October 2nd, 2004 06:07 PM
My Access front-end bloats! Rauken General Discussion 10 September 28th, 2004 05:06 AM
Print Access Report as PDF with Acrobat 6 Tony_VBACoder Setting Up & Running Reports 1 August 25th, 2004 11:06 AM
Save Report With CreateReport Coding Issue Jeff Conrad Setting Up & Running Reports 8 July 12th, 2004 08:39 AM


All times are GMT +1. The time now is 04:57 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.