Dim rsFiltered            As DAO.Recordset

    With Me.Recordset
        .Filter = "[Active] = True"
        Set rsFiltered = .OpenRecordset
    End With

    With rsFiltered
        If .RecordCount <> 0 Then
            Do Until .EOF
                ' Do something with each filtered record
        End If
    End With

On Error Resume Next
    If Not rsFiltered Is Nothing Then
        Set rsFiltered = Nothing
    End If
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter