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.Filte rClientName) Then
strWhere = strWhere & "(ClientNam e Like ""*" &
Me.FilterClient Name & "*"") AND "
End If
If Not IsNull(Me.Filte rMatterName) Then
strWhere = strWhere & "(MatterNam e Like ""*" &
Me.FilterMatter Name & "*"") AND "
End If
If Not IsNull(Me.Filte rMatterStatus) Then
strWhere = strWhere & "(MatterSta tus Like ""*" &
Me.FilterMatter Status & "*"") AND "
End If
If Not IsNull(Me.Filte rMatterSpecialt y) Then
strWhere = strWhere & "(MatterSpecial ty Like ""*" &
Me.FilterMatter Specialty & "*"") AND "
End If
If Not IsNull(Me.Filte rMatterSpecialt yGroup) Then
strWhere = strWhere & "(MatterSpecial tyGroup Like ""*" &
Me.FilterMatter SpecialtyGroup & "*"") AND "
End If
If Not IsNull(Me.Filte rIndustry) Then
strWhere = strWhere & "(Industry Like ""*" & Me.FilterIndust ry
& "*"") AND "
End If
If Not IsNull(Me.Filte rJurisdiction) Then
strWhere = strWhere & "(Jurisdict ion Like ""*" &
Me.FilterJurisd iction & "*"") AND "
End If
If Not IsNull(Me.Filte rResponsibleAtt orney) Then
strWhere = strWhere & "(ResponsibleAt torney Like ""*" &
Me.FilterRespon sibleAttorney & "*"") AND "
End If
If Not IsNull(Me.Start OpenDate) Then
strWhere = strWhere & "([] >= " & Format(Me.Start OpenDate,
conJetDate) & ") AND "
End If
If Not IsNull(Me.EndOp enDate) Then 'Less than the next day.
strWhere = strWhere & "([] < " & Format(Me.EndOp enDate + 1,
conJetDate) & ") AND "
End If
If Not IsNull(Me.Start CloseDate) Then
strWhere = strWhere & "([] >= " & Format(Me.Start CloseDate,
conJetDate) & ") AND "
End If
If Not IsNull(Me.EndCl oseDate) Then 'Less than the next day.
strWhere = strWhere & "([] < " & Format(Me.EndCl oseDate + 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
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.Filte rClientName) Then
strWhere = strWhere & "(ClientNam e Like ""*" &
Me.FilterClient Name & "*"") AND "
End If
If Not IsNull(Me.Filte rMatterName) Then
strWhere = strWhere & "(MatterNam e Like ""*" &
Me.FilterMatter Name & "*"") AND "
End If
If Not IsNull(Me.Filte rMatterStatus) Then
strWhere = strWhere & "(MatterSta tus Like ""*" &
Me.FilterMatter Status & "*"") AND "
End If
If Not IsNull(Me.Filte rMatterSpecialt y) Then
strWhere = strWhere & "(MatterSpecial ty Like ""*" &
Me.FilterMatter Specialty & "*"") AND "
End If
If Not IsNull(Me.Filte rMatterSpecialt yGroup) Then
strWhere = strWhere & "(MatterSpecial tyGroup Like ""*" &
Me.FilterMatter SpecialtyGroup & "*"") AND "
End If
If Not IsNull(Me.Filte rIndustry) Then
strWhere = strWhere & "(Industry Like ""*" & Me.FilterIndust ry
& "*"") AND "
End If
If Not IsNull(Me.Filte rJurisdiction) Then
strWhere = strWhere & "(Jurisdict ion Like ""*" &
Me.FilterJurisd iction & "*"") AND "
End If
If Not IsNull(Me.Filte rResponsibleAtt orney) Then
strWhere = strWhere & "(ResponsibleAt torney Like ""*" &
Me.FilterRespon sibleAttorney & "*"") AND "
End If
If Not IsNull(Me.Start OpenDate) Then
strWhere = strWhere & "([] >= " & Format(Me.Start OpenDate,
conJetDate) & ") AND "
End If
If Not IsNull(Me.EndOp enDate) Then 'Less than the next day.
strWhere = strWhere & "([] < " & Format(Me.EndOp enDate + 1,
conJetDate) & ") AND "
End If
If Not IsNull(Me.Start CloseDate) Then
strWhere = strWhere & "([] >= " & Format(Me.Start CloseDate,
conJetDate) & ") AND "
End If
If Not IsNull(Me.EndCl oseDate) Then 'Less than the next day.
strWhere = strWhere & "([] < " & Format(Me.EndCl oseDate + 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