beefwellington
Registered User.
- Local time
- Yesterday, 21:26
- Joined
- Jul 27, 2009
- Messages
- 14
I have a form that when I filter it's subform to only shows results between certain dates like say 7/1/2009 and 8/24/2009, everything shows up fine. I have an entry in the subform that is dated 7/13/2009. When I change the filter to 7/2/2009 - 8/24/2009, it gets filtered out an doesn't show up. The 7/13/2009 entry doesn't show up if the July date is set to a number from 7/2-7/9. 7/10/2009-8/24/2009 works fine and it shows up. I've posted my code below and any help would be appreciated. It seems to be everything is correct code wise and I've even outputted the filter string to a msgbox to verify it was accepting the correct dates I was inputting and it was getting the correct dates.
any help would be appreciated.
Code:
Private Sub cmdFilter_Click()
Dim strDateStart, strDateEnd As String
Dim strFilter As String
strDateStart = Format(Me.DateStart.Value, "mm/dd/yyyy")
strDateEnd = Format(Me.DateEnd.Value, "mm/dd/yyyy")
If Me.cboStatus.Value = "Down" Then
strFilter = "[DateTimeLogged] BETWEEN #" & strDateStart & "# AND #" & strDateEnd & "# AND [StatusDown] = 'Down'"
ElseIf Me.cboStatus.Value = "Up" Then
strFilter = "[DateTimeLogged] BETWEEN #" & strDateStart & "# AND #" & strDateEnd & "# AND [StatusUp] = 'Up'"
Else
strFilter = "[DateTimeLogged] BETWEEN #" & strDateStart & "# AND #" & strDateEnd & "#"
End If
'MsgBox strFilter
With Me.sfrmEquipment_History_List.Form
.FilterOn = False
.Filter = strFilter
.FilterOn = True
End With
End Sub
any help would be appreciated.