A
Ann
Hi, I have used the code below (there is more but the rest works) to create a
form with combo boxes so the value in each combo box chosen will filter and
give me a report with only the values I want to see. I didn't write this but
I can understand enough to make it work and have used it many times as long
as the values are all strings. But now I have a date value. Everything is
formatted to be a Short Date. I type the date (11/09/2006) and I apply the
filter to pull only employees terminated on that date. I get a type mismatch
error. My value that is being passed is the correct date but when I hover
over dtmEmployeeTermination I see 12:00:00 AM. It thinks this is the time
yet no where did I format it to be anyting but a Short Date. Can anyone help
me make this work for dates? Thanks.
Dim dtmEmployeeTermination As Date
'Employee Termination
If IsNull(Me.cboEmployeeTermination.Value) Then
dtmEmployeeTermination = "Like '*'"
Else
dtmEmployeeTermination = "='" & Me.cboEmployeeTermination.Value & "'"
End If
'Filter the string for each declared variable
strFilter = "[Age] " & strAge & _
" AND [Gender] " & strGender & _
" AND [dtmEmployeeTermination] " & dtmEmployeeTermination & _
" AND [YearIn] " & strYearAreIn
form with combo boxes so the value in each combo box chosen will filter and
give me a report with only the values I want to see. I didn't write this but
I can understand enough to make it work and have used it many times as long
as the values are all strings. But now I have a date value. Everything is
formatted to be a Short Date. I type the date (11/09/2006) and I apply the
filter to pull only employees terminated on that date. I get a type mismatch
error. My value that is being passed is the correct date but when I hover
over dtmEmployeeTermination I see 12:00:00 AM. It thinks this is the time
yet no where did I format it to be anyting but a Short Date. Can anyone help
me make this work for dates? Thanks.
Dim dtmEmployeeTermination As Date
'Employee Termination
If IsNull(Me.cboEmployeeTermination.Value) Then
dtmEmployeeTermination = "Like '*'"
Else
dtmEmployeeTermination = "='" & Me.cboEmployeeTermination.Value & "'"
End If
'Filter the string for each declared variable
strFilter = "[Age] " & strAge & _
" AND [Gender] " & strGender & _
" AND [dtmEmployeeTermination] " & dtmEmployeeTermination & _
" AND [YearIn] " & strYearAreIn