Hi Guys
I have a form with a set of combo filters which filter one after the other. now I need a date filter button. I have the following code which works fine, however when I filter the dates it will filter every employee's dates....
So an employee logs on filters their name, status, city and so on until they get the records they want to work that day, I need then to filter the date to & from and still just show that persons work and not everyone's.
I know can be done because Access has it on its standard right-click filters.
Please help and how can I add to this code to make that work.
Dim strDateField As String
Dim strWhere As String
Const strcJetDate = "\#mm\/dd\/yyyy\#"
strDateField = "[NextCallDate]"
If IsDate(Me.txtStartDate) Then
strWhere = "(" & strDateField & " >= " & Format(Me.txtStartDate, strcJetDate) & ")"
End If
If IsDate(Me.txtEndDate) Then
If strWhere <> vbNullString Then
strWhere = strWhere & " AND "
End If
strWhere = strWhere & "(" & strDateField & " < " & Format(Me.txtEndDate + 1, strcJetDate) & ")"
End If
Me.Filter = strWhere
Me.FilterOn = True
End sub
I have a form with a set of combo filters which filter one after the other. now I need a date filter button. I have the following code which works fine, however when I filter the dates it will filter every employee's dates....
So an employee logs on filters their name, status, city and so on until they get the records they want to work that day, I need then to filter the date to & from and still just show that persons work and not everyone's.
I know can be done because Access has it on its standard right-click filters.
Please help and how can I add to this code to make that work.

Dim strDateField As String
Dim strWhere As String
Const strcJetDate = "\#mm\/dd\/yyyy\#"
strDateField = "[NextCallDate]"
If IsDate(Me.txtStartDate) Then
strWhere = "(" & strDateField & " >= " & Format(Me.txtStartDate, strcJetDate) & ")"
End If
If IsDate(Me.txtEndDate) Then
If strWhere <> vbNullString Then
strWhere = strWhere & " AND "
End If
strWhere = strWhere & "(" & strDateField & " < " & Format(Me.txtEndDate + 1, strcJetDate) & ")"
End If
Me.Filter = strWhere
Me.FilterOn = True
End sub