Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need help with data loading in subforms!

Status
Not open for further replies.

SheilaAlighieri

Technical User
Nov 16, 2002
68
NL
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

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top