Rick Danger
asked on
Acces 2013: Displaying first record in subforms
In the attached example, which I actually got from another expert, there a 3 subforms used in a master form "F__PPSAccounts". When I open this form it shows the first record of subform "S_ContractYears" and the first record of "S_Guarantees". But the other subform "S_RevSharePmts" doesn't show any records, even though for the combination of the other 2 subforms it should show 4 records. It is not until you click on the second record on "S_Guarantees" then back to the first record that it displays and records.
I need the 3 forms to show the relevant records as soon as the form is open. So in the attached example, when you open the
"F__PPSAccounts" form it should show:
2 records in "S_ContractYears" (416 and 417)
2 records in "S_Guarantees" (15 and 16)
4 records in "S_RevSharePmts" (27, 28, 29 and 34)
It's OK when you click on the second record in the "S_ContractYears" subform, but I need it to be correct as soon as you open the main form please
Form-Parent-Child-Grandchild--1-.accdb
I need the 3 forms to show the relevant records as soon as the form is open. So in the attached example, when you open the
"F__PPSAccounts" form it should show:
2 records in "S_ContractYears" (416 and 417)
2 records in "S_Guarantees" (15 and 16)
4 records in "S_RevSharePmts" (27, 28, 29 and 34)
It's OK when you click on the second record in the "S_ContractYears" subform, but I need it to be correct as soon as you open the main form please
Form-Parent-Child-Grandchild--1-.accdb
ASKER
The 2nd subform is linked to the first, and the 3rd is linked to the 2nd.
The 2nd and 3rd subforms have tables as their recordsource
The OnCurrent Event on the 1st subform does this:
Me.Parent![S_RevSharePmts] .Requery
Me.Parent![sfS_Guarantees] .Requery
The 2nd subform has its Master field as: [S_ContractYears].Form![Co ntractID] (from the 1st subform)
and its Child field as: ContractID
Its OnCurrent Event does this: Me.Parent![S_RevSharePmts] .Requery
The 3rd subform has its Master field as: [sfS_Guarantees].Form![Gua ranteeID] (from the 2nd subform.
and its Child field as: GuaranteetID
Its does not have an OnCurrent Event.
The 2nd and 3rd subforms have tables as their recordsource
The OnCurrent Event on the 1st subform does this:
Me.Parent![S_RevSharePmts]
Me.Parent![sfS_Guarantees]
The 2nd subform has its Master field as: [S_ContractYears].Form![Co
and its Child field as: ContractID
Its OnCurrent Event does this: Me.Parent![S_RevSharePmts]
The 3rd subform has its Master field as: [sfS_Guarantees].Form![Gua
and its Child field as: GuaranteetID
Its does not have an OnCurrent Event.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
another option is to use the current event of the form "F__PPSAccounts", depending on the way you are using the main form..
private sub form_current()
me.S_RevSharePmts.requery
end sub
private sub form_current()
me.S_RevSharePmts.requery
end sub
ASKER
Thanks for taking the time!
Is this 3rd subform linked in a master-child relationship to the main form? If so, how
If not, what is the query you are using for the subform. If you are actually using a query in this subform, that is linked to the current record in the two other subforms, then you should have code in the Current event of those two other subforms with requeries the recordset in the 3rd subform.
Dale