hi group,
I am using a continuous form and filters to make a user-friendly search
form. But the filter is being applied, and I'm also getting a
parameter box that pops up- so the filter isn't even using the form. I
think its a problem in my coding, which is pasted below. Any help is
greatly appreciated! Thanks!
rivate Sub cmdFilter_Click()
Dim strWhere As String 'The criteria string.
Dim lngLen As Long 'Length of the criteria
string to append to.
Const conJetDate = "\#mm\/dd\/yyyy\#" 'The format expected for
dates in a JET query string.
'************************************************* **********************
'************************************************* **********************
If Not IsNull(Me.FilterClientName) Then
strWhere = strWhere & "(ClientName Like ""*" &
Me.FilterClientName & "*"") AND "
End If
If Not IsNull(Me.FilterMatterName) Then
strWhere = strWhere & "(MatterName Like ""*" &
Me.FilterMatterName & "*"") AND "
End If
If Not IsNull(Me.FilterMatterStatus) Then
strWhere = strWhere & "(MatterStatus Like ""*" &
Me.FilterMatterStatus & "*"") AND "
End If
If Not IsNull(Me.FilterMatterSpecialty) Then
strWhere = strWhere & "(MatterSpecialty Like ""*" &
Me.FilterMatterSpecialty & "*"") AND "
End If
If Not IsNull(Me.FilterMatterSpecialtyGroup) Then
strWhere = strWhere & "(MatterSpecialtyGroup Like ""*" &
Me.FilterMatterSpecialtyGroup & "*"") AND "
End If
If Not IsNull(Me.FilterIndustry) Then
strWhere = strWhere & "(Industry Like ""*" & Me.FilterIndustry
& "*"") AND "
End If
If Not IsNull(Me.FilterJurisdiction) Then
strWhere = strWhere & "(Jurisdiction Like ""*" &
Me.FilterJurisdiction & "*"") AND "
End If
If Not IsNull(Me.FilterResponsibleAttorney) Then
strWhere = strWhere & "(ResponsibleAttorney Like ""*" &
Me.FilterResponsibleAttorney & "*"") AND "
End If
If Not IsNull(Me.StartOpenDate) Then
strWhere = strWhere & "([] >= " & Format(Me.StartOpenDate,
conJetDate) & ") AND "
End If
If Not IsNull(Me.EndOpenDate) Then 'Less than the next day.
strWhere = strWhere & "([] < " & Format(Me.EndOpenDate + 1,
conJetDate) & ") AND "
End If
If Not IsNull(Me.StartCloseDate) Then
strWhere = strWhere & "([] >= " & Format(Me.StartCloseDate,
conJetDate) & ") AND "
End If
If Not IsNull(Me.EndCloseDate) Then 'Less than the next day.
strWhere = strWhere & "([] < " & Format(Me.EndCloseDate + 1,
conJetDate) & ") AND "
End If
'************************************************* **********************
'************************************************* **********************
lngLen = Len(strWhere) - 5
If lngLen <= 0 Then
MsgBox "No criteria", vbInformation, "Nothing to do."
Else strWhere = Left$(strWhere, lngLen)
Me.Filter = strWhere
Me.FilterOn = True
End If
End Sub