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
|
|||
|
|||
Can recordsource parameters be set in code?
I'm using Access 97. I have a subform, and the
RecordSource of the subform is a query that contains a parameter. I am prompted to enter the value of the parameter every time I navigate to a different record in the parent form. However, I want to set the parameter's value in code, avoiding manual entry. I need to set the parameter value, and requery the subform, every time the parent form navigates to a new record. Can this be done in code? The value of the parameter is a field that is available in the parent form. The link master/link child properties don't solve my problem because the recordsource of the subform is a union query, and performance is unacceptable when I rely on link master/link child properties. The root cause of this performance probelm is illustrated by the following two queries. They are equivalent, but the first one executes MUCH faster: Select * From Q1 Where Fld = value_1 UNION Select * From Q2 Where Fld = value_1 Select * From (Select * From Q1 UNION Select * From Q2) Where Fld = value_1 The second query is effectively what I get when I use the link master/link child properties. So, I want to use a parameter in the query and set it in code. Thanks, Paul |
#2
|
|||
|
|||
Can recordsource parameters be set in code?
On Mon, 14 Jun 2004 18:25:58 -0700,
wrote: I need to set the parameter value, and requery the subform, every time the parent form navigates to a new record. Can this be done in code? The value of the parameter is a field that is available in the parent form. Just use that control as (part of) the Subform's Master Link Field, and the field that it is searching as the Child Link Field. Or, explicitly reference the form control in the parameter: =[Forms]![yourformname]![controlname] John W. Vinson[MVP] Come for live chats every Tuesday and Thursday http://go.compuserve.com/msdevapps?loc=us&access=public |
Thread Tools | |
Display Modes | |
|
|