SheilaAlighieri
Technical User
This going to be a bit hard to explain
But here I go.
I have one form with two subforms. Subform 1 is linked to the main form. Subform 2 is linked to subform 1. I use the on current action in subform 1. See the end of this message for my code.
Here is my problem: when I open my main form there is no data loaded for subform 2. When I swap the record, or make a new selection in subform 1, the data is loaded.
How can I make sure the data in subform 2 is loaded as soon as the form is openend?
I use a query as the basis for the forms. Maybe it is important
Furthermore, this form sometimes makes Access to crash. Is there an explanation for it? Just to make sure I give all info, I will give my link fields for the forms.
Subform1:
Link Child Fields: Account Name;Budget Year
Link Master Fields: Account Name;Budget Year
Subform2:
Link Child Fields: BudgetID
Link Master Fields: [Budget Commitments Subform1].Form![BudgetID]
My on current code:
Private Sub Form_Current()
Dim strParentDocName As String
On Error Resume Next
strParentDocName = Me.Parent.Name
If Err <> 0 Then
GoTo Form_Current_Exit
Else
On Error GoTo Form_Current_Err
Me.Parent![Budget Commitments Subform2].Requery
End If
Form_Current_Exit:
Exit Sub
Form_Current_Err:
MsgBox Err.Description
Resume Form_Current_Exit
End Sub
Thanks,
Sheila
I have one form with two subforms. Subform 1 is linked to the main form. Subform 2 is linked to subform 1. I use the on current action in subform 1. See the end of this message for my code.
Here is my problem: when I open my main form there is no data loaded for subform 2. When I swap the record, or make a new selection in subform 1, the data is loaded.
How can I make sure the data in subform 2 is loaded as soon as the form is openend?
I use a query as the basis for the forms. Maybe it is important
Furthermore, this form sometimes makes Access to crash. Is there an explanation for it? Just to make sure I give all info, I will give my link fields for the forms.
Subform1:
Link Child Fields: Account Name;Budget Year
Link Master Fields: Account Name;Budget Year
Subform2:
Link Child Fields: BudgetID
Link Master Fields: [Budget Commitments Subform1].Form![BudgetID]
My on current code:
Private Sub Form_Current()
Dim strParentDocName As String
On Error Resume Next
strParentDocName = Me.Parent.Name
If Err <> 0 Then
GoTo Form_Current_Exit
Else
On Error GoTo Form_Current_Err
Me.Parent![Budget Commitments Subform2].Requery
End If
Form_Current_Exit:
Exit Sub
Form_Current_Err:
MsgBox Err.Description
Resume Form_Current_Exit
End Sub
Thanks,
Sheila