DanG
Registered User.
- Local time
- Today, 11:39
- Joined
- Nov 4, 2004
- Messages
- 477
I have an employee form and I was able to set up a toggle button that toggles between "all" employees and "active and recently terminated" employees (within the last year). My boss just doesn't always want ot look through employees that have been termed 6 years ago.
The filter works fine and does what it should. The only thing I need to do now is put a similar restriction on the employee search field. The employee search field is a combo box with the employee number and name and uses the code below to find the employee.
Toggle Button Code:
Find Employe Combo Box:
Thank you in advance!
The filter works fine and does what it should. The only thing I need to do now is put a similar restriction on the employee search field. The employee search field is a combo box with the employee number and name and uses the code below to find the employee.
Toggle Button Code:
Code:
Private Sub Toggle147_AfterUpdate()
If Me.Toggle147 = True Then
Me.Filter = "(((tblEmployee.dtTermDate)>DateAdd('yyyy',-3,Date()) Or (tblEmployee.dtTermDate) Is Null))"
Me.FilterOn = True
Else
Me.Filter = ""
Me.FilterOn = False
End If
End Sub
Find Employe Combo Box:
Code:
Private Sub FindEmployee_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[txtEmpNum] = '" & Me![FindEmployee] & "'"
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub
Thank you in advance!