phil.palmer
New member
- Local time
- Today, 03:31
- Joined
- Apr 8, 2014
- Messages
- 2
Good Afternoon everyone,
First, I would like to say I am new however trying to learn...please be gentle.
I am trying to make a search option in my form header. Right now I have two unbound combo boxes (CboAccountsfilter and cboCourseName) that I can use to filter my records. Currently, I can use the drop down for CboAccountsfilter and a list of accounts will appear. When I select one, the corresponding Course Names will appear in cboCourseName. This works fine...Code below. I would like to take the filtering a step farther and add checkboxes to filter the data. I my form, there currently exist several check boxes (yes/no)...(Priority, Rep Top Target, Manager Top Target, ect). I would like to have the option to use a check box to filter. I.E if I had a checkbox in my header called PriorityFilter, if checked it would only bring up those records that met the two combo boxes criteria and was a priority. I hope this make sense.
Below is the code I have so far...it doesnt have anything for the checkbox because I am at a lost of how to get started. Again, I am new but eager
Private Sub CboAccountsfilter_Change()
Me.Requery
Me.cboCourseName.Requery
Me.Check178.Requery
End Sub
Private Sub CboAccountsfilter_AfterUpdate()
Dim strFilter As String
Me.cboCourseName.Value = Null
Me.Requery
If Len(Me.cboCourseName & vbNullString) > 0 Then
strFilter = "[finalname]=" & Chr(34) & Me.cboCourseName & Chr(34) & " And "
End If
If Len(Me.CboAccountsfilter & vbNullString) > 0 Then
strFilter = strFilter & "[Account Name]=" & Chr(34) & Me.CboAccountsfilter & Chr(34) & " AND "
End If
If Right(strFilter, 5) = " AND " Then
strFilter = Left(strFilter, Len(strFilter) - 5)
End If
Me.Filter = strFilter
Me.FilterOn = True
End Sub
Private Sub cboCourseName_AfterUpdate()
Dim strFilter As String
cboCourseName.Requery
If Len(Me.cboCourseName & vbNullString) > 0 Then
strFilter = "[finalname]=" & Chr(34) & Me.cboCourseName & Chr(34) & " And "
End If
If Len(Me.CboAccountsfilter & vbNullString) > 0 Then
strFilter = strFilter & "[Account Name]=" & Chr(34) & Me.CboAccountsfilter & Chr(34) & " AND "
End If
If Right(strFilter, 5) = " AND " Then
strFilter = Left(strFilter, Len(strFilter) - 5)
End If
Me.Filter = strFilter
Me.FilterOn = True
Me.Requery
End Sub
First, I would like to say I am new however trying to learn...please be gentle.
I am trying to make a search option in my form header. Right now I have two unbound combo boxes (CboAccountsfilter and cboCourseName) that I can use to filter my records. Currently, I can use the drop down for CboAccountsfilter and a list of accounts will appear. When I select one, the corresponding Course Names will appear in cboCourseName. This works fine...Code below. I would like to take the filtering a step farther and add checkboxes to filter the data. I my form, there currently exist several check boxes (yes/no)...(Priority, Rep Top Target, Manager Top Target, ect). I would like to have the option to use a check box to filter. I.E if I had a checkbox in my header called PriorityFilter, if checked it would only bring up those records that met the two combo boxes criteria and was a priority. I hope this make sense.
Below is the code I have so far...it doesnt have anything for the checkbox because I am at a lost of how to get started. Again, I am new but eager
Private Sub CboAccountsfilter_Change()
Me.Requery
Me.cboCourseName.Requery
Me.Check178.Requery
End Sub
Private Sub CboAccountsfilter_AfterUpdate()
Dim strFilter As String
Me.cboCourseName.Value = Null
Me.Requery
If Len(Me.cboCourseName & vbNullString) > 0 Then
strFilter = "[finalname]=" & Chr(34) & Me.cboCourseName & Chr(34) & " And "
End If
If Len(Me.CboAccountsfilter & vbNullString) > 0 Then
strFilter = strFilter & "[Account Name]=" & Chr(34) & Me.CboAccountsfilter & Chr(34) & " AND "
End If
If Right(strFilter, 5) = " AND " Then
strFilter = Left(strFilter, Len(strFilter) - 5)
End If
Me.Filter = strFilter
Me.FilterOn = True
End Sub
Private Sub cboCourseName_AfterUpdate()
Dim strFilter As String
cboCourseName.Requery
If Len(Me.cboCourseName & vbNullString) > 0 Then
strFilter = "[finalname]=" & Chr(34) & Me.cboCourseName & Chr(34) & " And "
End If
If Len(Me.CboAccountsfilter & vbNullString) > 0 Then
strFilter = strFilter & "[Account Name]=" & Chr(34) & Me.CboAccountsfilter & Chr(34) & " AND "
End If
If Right(strFilter, 5) = " AND " Then
strFilter = Left(strFilter, Len(strFilter) - 5)
End If
Me.Filter = strFilter
Me.FilterOn = True
Me.Requery
End Sub