I have the following in a form:
- Main Form which stores EE details [Mileage Expense Form]
- 1st subform [SubFSiteInfo] - a continuous form with a combo box which allows either selection of an existing contract or option to open a Contract Form to add.
- 2nd subform [SubFMileageInfo] - a continuous form which shows employee travel information relative to the contract number they are working on at that time.
This all works fine and returns the correct records.
However, when you go back into the form and click on a record on the 1st subform, the related records to not show on the 2nd subform until you click on to the 2nd record of the first subform then click back on to the first record.
I assume that there is something wrong with the requery.
I have the following code in the On Current event of the 1st subform:
Any and all advice would be very much appreciated.
Shona
- Main Form which stores EE details [Mileage Expense Form]
- 1st subform [SubFSiteInfo] - a continuous form with a combo box which allows either selection of an existing contract or option to open a Contract Form to add.
- 2nd subform [SubFMileageInfo] - a continuous form which shows employee travel information relative to the contract number they are working on at that time.
This all works fine and returns the correct records.
However, when you go back into the form and click on a record on the 1st subform, the related records to not show on the 2nd subform until you click on to the 2nd record of the first subform then click back on to the first record.
I assume that there is something wrong with the requery.
I have the following code in the On Current event of the 1st subform:
Code:
Sub Form_Current()
' This code created by Form Wizard.
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![SubFMileageInfo].Requery
End If
Form_Current_Exit:
Exit Sub
Form_Current_Err:
MsgBox Err.Description
Resume Form_Current_Exit
End Sub
Shona
Comment