Event not triggering when clicking Search Button

rwrig

Registered User.
Local time
Today, 14:48
Joined
May 22, 2014
Messages
19
Hello All:

I have the below VBA in a from for it to filter the records below based on the criteria:

Private Sub Search_Click()
Dim strWhere As String

strWhere = IIf(Len(Me.AssignedTo & "") <> 0, "([AssignedTo] Like ""*" & Me.AssignedTo & "*"") AND", "") & _

IIf(Len(Me.OpenedBy & "") <> 0, "([OpenedBy] Like ""*" & Me.OpenedBy & "*"") AND", "") & _

IIf(Len(Me.Status & "") <> 0, "([Status] Like ""*" & Me.Status & "*"") AND", "") & _

IIf(Len(Me.Category & "") <> 0, "([Category] Like ""*" & Me.Category & "*"") AND", "") & _

IIf(Len(Me.Priority & "") <> 0, "([Priority] Like ""*" & Me.Priority & "*"") AND", "") & _

IIf(Len(Me.OpenedDateFrom & "") <> 0, "([EnteredOn] >= #" & Format(Me.OpenedDateFrom, "mm/dd/yyyy") & "#) AND", "") & _

IIf(Len(Me.DueDateFrom & "") <> 0, "([EnteredOn] <= #" & Format(Me.DueDateFrom, "mm/dd/yyyy") & "#) AND", "")

If Len(strWhere & "") = 0 Then
MsgBox "No criteria", vbInformation, "Nothing to do."
Else
Me.Filter = Left(strWhere, Len(strWhere & "") - 4)

Me.FilterOn = True

Me.Requery

End If

End Sub

When I click the search button nothing happens, is there something wrong with my code??
 

Attachments

  • Snap Shot of Form.PNG
    Snap Shot of Form.PNG
    92.9 KB · Views: 82
Paul your right the source table is Browse All Issues and its in the footer on the form. So should I set up each search parameter like:

If(Len(Me!Subform1.Browse_All_Issues.AssignedTo & "") <> 0, "([AssignedTo] Like ""*" & Me!Subform1.Browse_All_Issues.AssignedTo & "*"") AND", "") & _
 
No, the button looks to be on the main form so Me is fine there. I meant the lines setting the filter.
 
So how do I set up the code to get the filters on the form to returns the results on my form that displays on the source table?
 

Users who are viewing this thread

Back
Top Bottom