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. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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 | |
|
|
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 |