J
Justin83716
Damian was helping me with this, and I thought that we had it. However it now
appears I was wrong. So I'm re-posting my problem.
I have a form that is being used to select criteria for a search. One of the
criteria I have is a weekly allowance criteria with a low and high text box.
I would like the user to be able to enter either a low amount or high amount
or both, and have the results fall within the range specified. With the help
of Damian I have accomplished this. The problem now is that when no criteria
is selected I want the search to ignore the fields and move to the next
criteria. If no criteria is specified anywhere I want ALL records to be
returned. As this is a very small DB this should not be any problem. Here is
my code so far.
Private Sub cmdSearch_Click()
Const cInvalidDateError As String = "You have entered an invalid date."
Dim strWhere As String
strWhere = "1=1 "
'If Weekly Allowance (tblEmployeeProjectDetails)
If IsNull(Me.txtWeeklyAllowanceLow) Then
'Create Predicate
strWhere = strWhere & " AND " & "[Wk/Allow] <= " & Me.txtWeeklyAllowanceHigh
ElseIf IsNull(Me.txtWeeklyAllowanceHigh) Then
strWhere = strWhere & " AND " & "[Wk/Allow] >= " & Me.txtWeeklyAllowanceLow
Else
strWhere = strWhere & " AND " & "[Wk/Allow] between " &
Me.txtWeeklyAllowanceLow & " AND " & Me.txtWeeklyAllowanceHigh
End If
Thanks for all the help...Again!
appears I was wrong. So I'm re-posting my problem.
I have a form that is being used to select criteria for a search. One of the
criteria I have is a weekly allowance criteria with a low and high text box.
I would like the user to be able to enter either a low amount or high amount
or both, and have the results fall within the range specified. With the help
of Damian I have accomplished this. The problem now is that when no criteria
is selected I want the search to ignore the fields and move to the next
criteria. If no criteria is specified anywhere I want ALL records to be
returned. As this is a very small DB this should not be any problem. Here is
my code so far.
Private Sub cmdSearch_Click()
Const cInvalidDateError As String = "You have entered an invalid date."
Dim strWhere As String
strWhere = "1=1 "
'If Weekly Allowance (tblEmployeeProjectDetails)
If IsNull(Me.txtWeeklyAllowanceLow) Then
'Create Predicate
strWhere = strWhere & " AND " & "[Wk/Allow] <= " & Me.txtWeeklyAllowanceHigh
ElseIf IsNull(Me.txtWeeklyAllowanceHigh) Then
strWhere = strWhere & " AND " & "[Wk/Allow] >= " & Me.txtWeeklyAllowanceLow
Else
strWhere = strWhere & " AND " & "[Wk/Allow] between " &
Me.txtWeeklyAllowanceLow & " AND " & Me.txtWeeklyAllowanceHigh
End If
Thanks for all the help...Again!