trên Excel thì được còn trên access thì diễn đàn này ít bạn làm được lắm và cũng ít người húng thú với nó....bạn hãy cho xem có ai giúp được ko nha
		
		
	 
em thấy cái này gần giống cái của em , dang muốn làm theo nhưng khổ nổi không hiêu được ngôn ngữ lập trình nên không tài nào bắt chước được
' *************************************
'
' Search Form Example
'     by gromit
'     12-26-05
'
' You are free to adapt this for your own use
'
' *************************************
Option Compare Database
Option Explicit
Private Sub btnClear_Click()
    Dim intIndex As Integer
    
    ' Clear all search items
    Me.txtFirstName = ""
    Me.txtLastName = ""
    Me.txtMaxAge = ""
    Me.txtMinAge = ""
    Me.cmbCompany = 0
    Me.cmbCountry = 0
    
    ' De-select each item in Color List (multiselect list)
    For intIndex = 0 To Me.lstFavColor.ListCount - 1
        Me.lstFavColor.Selected(intIndex) = False
    Next
    
End Sub
Private Sub btnSearch_Click()
    
    ' Update the record source
    Me.frmsubClients.Form.RecordSource = "SELECT * FROM qryClientData " & BuildFilter
    
    ' Requery the subform
    Me.frmsubClients.Requery
End Sub
Private Sub Form_Load()
    
    ' Clear the search form
    btnClear_Click
    
End Sub
Private Function BuildFilter() As Variant
    Dim varWhere As Variant
    Dim varColor As Variant
    Dim varItem As Variant
    Dim intIndex As Integer
    varWhere = Null  ' Main filter
    varColor = Null  ' Subfilter used for colors
    
    ' Check for LIKE First Name
    If Me.txtFirstName > "" Then
        varWhere = varWhere & "[FirstName] LIKE """ & Me.txtFirstName & "*"" AND "
    End If
    
    ' Check for LIKE Last Name
    If Me.txtLastName > "" Then
        varWhere = varWhere & "[LastName] LIKE """ & Me.txtLastName & "*"" AND "
    End If
    
    ' Check for min Age
    If Me.txtMinAge > "" Then
        varWhere = varWhere & "[Age] > " & Me.txtMinAge & " AND "
    End If
    
    ' Check for max Age
    If Me.txtMaxAge > "" Then
        varWhere = varWhere & "[Age] < " & Me.txtMaxAge & " AND "
    End If
    
    ' Check for CompanyID
    If Me.cmbCompany > 0 Then
        varWhere = varWhere & "[CompanyID] = " & Me.cmbCompany & " AND "
    End If
    
    ' Check for CountryID
    If Me.cmbCountry > 0 Then
        varWhere = varWhere & "[CountryID] = " & Me.cmbCountry & " AND "
    End If
    
    ' Check for Colors in multiselect list
    For Each varItem In Me.lstFavColor.ItemsSelected
        varColor = varColor & "[FavColor] = """ & _
                    Me.lstFavColor.ItemData(varItem) & """ OR "
        
    Next
    
    ' Test to see if we have subfilter for colors...
    If IsNull(varColor) Then
        ' do nothing
    Else
        ' strip off last "OR" in the filter
        If Right(varColor, 4) = " OR " Then
            varColor = Left(varColor, Len(varColor) - 4)
        End If
        
        ' Add some parentheses around the subfilter
        varWhere = varWhere & "( " & varColor & " )"
    End If
    
    ' Check if there is a filter to return...
    If IsNull(varWhere) Then
        varWhere = ""
    Else
        varWhere = "WHERE " & varWhere
        
        ' strip off last "AND" in the filter
        If Right(varWhere, 5) = " AND " Then
            varWhere = Left(varWhere, Len(varWhere) - 5)
        End If
    End If
    
    BuildFilter = varWhere
    
End Function