Hello All.
I have a form called AssignmentLedgerRead2, that has around 110 thousand records in its record source. Therefore I have a filter on the form's On Open event, which filters only by the staff's non-completed assignments.
I currently have the following code to open the Assignments form and apply a filter:
When this command button is clicked it opens the AssignmentLedgerRead2 form, and applies the form's On Open event. Once the form is open if I then click on the command button again, it filters by the [Job Number] which is what I need.
However is there a way to open the form, and then apply the filter once the form is open?
This would allow the filter to be applied correctly first time around.
Thanks for your help.
I have a form called AssignmentLedgerRead2, that has around 110 thousand records in its record source. Therefore I have a filter on the form's On Open event, which filters only by the staff's non-completed assignments.
I currently have the following code to open the Assignments form and apply a filter:
Code:
On Error GoTo Err_CommandJobs_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "AssignmentLedgerRead2"
If IsNull(TextJobNumber) Then GoTo NoJobNo
stLinkCriteria = "[Job No]=" & Me![Job Number]
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit Sub
NoJobNo:
DoCmd.OpenForm stDocName, , "NextJob"
Exit_CommandJobs_Click:
Exit Sub
Err_CommandJobs_Click:
MsgBox Err.Description
Resume Exit_CommandJobs_Click
When this command button is clicked it opens the AssignmentLedgerRead2 form, and applies the form's On Open event. Once the form is open if I then click on the command button again, it filters by the [Job Number] which is what I need.
However is there a way to open the form, and then apply the filter once the form is open?
This would allow the filter to be applied correctly first time around.
Thanks for your help.