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
|
|||
|
|||
passing value from subform
I have a Form “Developments” with a subform “Lots”. My “Lots” table has a
auto number key [LotID]. I want to display fi;tered “LotDetail” form based on which lot I select on the lots subform AND be able to Add/Edit the lot detail records. Problem: When I display my LotDetail records, the correct records show but I have to manually enter the “LotID” in order to add records. The “lotDetail” form is not picking up that lotID from the subform “Lots” How do I pass this value? (I’m open the “LotDetail” with a macro where a where condition LotID=forms!Lotsubform!LotID. |
#2
|
|||
|
|||
passing value from subform
On Wed, 20 Dec 2006 08:05:00 -0800, David#
wrote: I have a Form Developments with a subform Lots. My Lots table has a auto number key [LotID]. I want to display fi;tered LotDetail form based on which lot I select on the lots subform AND be able to Add/Edit the lot detail records. Problem: When I display my LotDetail records, the correct records show but I have to manually enter the LotID in order to add records. The lotDetail form is not picking up that lotID from the subform Lots How do I pass this value? (Im open the LotDetail with a macro where a where condition LotID=forms!Lotsubform!LotID. YOu'll need to use VBA code rather than a Macro, I'd guess; have it set the DefaultValue property of the LotDetail LotID control. Something like Private Sub cmdOpenLotDetail_Click() DoCMd.OpenForm "lotDetail", WhereCondition:=Me.LotID, _ OpenArgs:=Me.LotID End SUb and in the Open event of lotDetail Private Sub Form_Open(Cancel as Integer) If Me.OpenArgs & "" "" Then ' did user pass an ID? Me.txtLotID.DefaultValue = "'" & Me.OpenArgs & "'" End If End Sub John W. Vinson[MVP] |
Thread Tools | |
Display Modes | |
|
|