Advertisement

06.11.2008 at 02:03AM PDT, ID: 23475002
[x]
Attachment Details

Filter records in continuous subforms based on the combination selection of combo boxes from the main form

Asked by Graceho in Access Forms, Microsoft Access Database, VB Controls

hi,
I have trouble filtering data in the subform. There are 4 combo boxes in the main form named "CATDATA" and the subform's name is "sfrProjectList". I have a Filter command button named cmdFilter in the main Form. Upon clicking the button, the data in the subform should be filtered based on any combination selection of values from the 4 combos. The problem is my code doesnt work at all. Perhaps could you write me a source code for the cmdFilter command button? Thanks so much.. Below are the code for cmdFilter that i used and it doesn't work. The data from the subform sftProjectList are obtain from the "ProjectList" table
Private Sub cmdFilter_Click()
    Dim strFilter As String

    If Len(Me.cboFilterStatus & vbNullString) > 0 Then
        strFilter = "ProjectList.StatusID=" & Me.cboFilterStatus.Value
    End If

    If Len(Me.cboFilterAccuracy.Value & vbNullString) > 0 Then
        If Len(strFilter) > 0 Then
            strFilter = strFilter & " AND "
        End If
        strFilter = strFilter & "ProjectList.AccuracyID='" & Me.cboFilterAccuracy.Value & "'"
    End If
   
    If Len(Me.cboFilterDepartment.Value & vbNullString) > 0 Then
      If Len(strFilter) > 0 Then
           strFilter = strFilter & " AND "
        End If
        strFilter = strFilter & "ProjectList.DepartmentID='" & Me.cboFilterDepartment.Value & "'"
    End If
   
     If Len(Me.cboFilterARPOther.Value & vbNullString) > 0 Then
        If Len(strFilter) > 0 Then
            strFilter = strFilter & " AND "
        End If
        strFilter = strFilter & "ProjectList.ARPOther='" & Me.cboFilterARPOther.Value & "'"
    End If

    If Len(strFilter) > 0 Then
       Me.sfrProjectList.Form.Filter = strFilter
        Me.sfrProjectList.Form.FilterOn = True
        Me.sfrProjectList.Form.Requery
    Else
        Me.sfrProjectList.Form.FilterOn = False
    End If
End Sub Start Free Trial
[+][-]06.11.2008 at 05:18AM PDT, ID: 21759163

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.11.2008 at 07:21AM PDT, ID: 21760294

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06.11.2008 at 07:56AM PDT, ID: 21760686

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.11.2008 at 08:22AM PDT, ID: 21760992

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06.11.2008 at 10:31AM PDT, ID: 21762266

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.11.2008 at 06:10PM PDT, ID: 21765411

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06.12.2008 at 03:33AM PDT, ID: 21767865

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Access Forms, Microsoft Access Database, VB Controls
Sign Up Now!
Solution Provided By: MikeToole
Participating Experts: 1
Solution Grade: A
 
 
[+][-]06.12.2008 at 06:15PM PDT, ID: 21775020

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06.12.2008 at 06:46PM PDT, ID: 21775156

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06.12.2008 at 07:18PM PDT, ID: 21775269

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628