Filter applied to form limits records shown on subform

J

Jon L.

I've got an option group with five buttons on a form [client] to limit the
number of records that is shown on that form. This is so I don't have to
scroll through ~100 clients to find the client I'm looking for. I'm using
the following code for the option group:

Private Sub Frame28_Click()
Dim clientLimit As Integer
clientLimit = Me.Frame28
Select Case [clientLimit]
Case Is = 1
DoCmd.ShowAllRecords
Case Is = 2
DoCmd.ApplyFilter , "client_name <= " & "'" & "E" & "'"
Case Is = 3
DoCmd.ApplyFilter , "client_name <= " & "'" & "N" & "'" & " AND
client_name >= " & "'" & "E" & "'"
Case Is = 4
DoCmd.ApplyFilter , "client_name <= " & "'" & "T" & "'" & " AND
client_name >= " & "'" & "N" & "'"
Case Is = 5
DoCmd.ApplyFilter , "client_name >= " & "'" & "T" & "'"
End Select
End Sub


The problem is that my subform [projects] will not correctly display all of
the projects for the client when any of the filters are applied. It will
show all the projects for any of the clients when the ShowAllRecords is used.
The [projects] subform is linked to the [client] form by client_name.

If it matters, I'm using MySQL for the back end and Access
(.mdb - not a project file) for the forms/reports.

If there's another/easeir way I can limit the records displayed (applying
that limit on the form after it's loaded) I'm certainly open to suggestions.

-Jon
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top