You want to filter by the value of the combo, and sort by that field as
well?
My preferred approach would be to use the AfterUpdate event of the combo to
set the Filter and OrderBy properties of the form, like this:
Private Sub Combo49_AfterUpdate()
If Me.Dirty Then Me.Dirty = False 'Save first
Me.Filter = "[IPT] = '" & Me.Combo49 & "'"
Me.OrderBy = "[IPT]"
Me.FilterOn = True
Me.OrderByOn = True
End Sub
It might be even more efficient to change the RecordSource of the form to a
query string, but the users can't just remove the filter as easily that way.
I don't think you were asking how to assign the secondary and tertiary
fields to the sorting order (so it sorts by IPT first, and then within that
by Tier5, and then within that by Risk), but the code would be:
Me.OrderBy = "IPT, Tier5, Risk"
--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users -
http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
"rquinnan" <rquinnan@gmail.com> wrote in message
news:1107473185.996541.292930@g14g2000cwa.googlegr oups.com...[color=blue]
> Good Evening all, I would greatly appreciate any assistance on this
> Access 2003 quandary I'm in. And I do apologize if this has been
> answered somewhere else, I didn't see one that addressed my problem
> though. I'm looking to be able to sort multiple fields from a form
> whose record source is a query of fields from a single table.
>
> Background:
> The default view is "Continuous Forms." and in the Form Header
> section of the form's design, I have 4 'combo boxes' that are
> made to look like drop-down lists. They go left to right in this order:
> IPT, Tier5, Risk, and Status. The Row Source Type is 'Table/Query'
> and the Row Source for the first looks like: "SELECT IPT.ipt FROM
> IPT ORDER BY IPT.ipt;"
>
> The [Event Procedure] for 'On Change' has this Visual basic code
> for the 4 combo boxes:
> ___
> Private Sub Combo49_Change()
> DoCmd.ApplyFilter , "[IPT] = '" & Me.Combo49 & "'"
> End Sub
> ___
> Private Sub Combo83_Change()
> DoCmd.ApplyFilter , "[Tier5] = '" & Me.Combo83 & "'"
> End Sub
> ___
> Private Sub Combo71_Change()
> DoCmd.ApplyFilter , "[Risk] = '" & Me.Combo71 & "'"
> End Sub
> ___
> Private Sub Combo72_Change()
> DoCmd.ApplyFilter , "[OpenClosed] = '" & Me.Combo72 & "'"
> End Sub
> ___
>
> Issue:
> The filters work fine and instantly filter hundreds of fields, but I
> can only sort one at a time, rather than have it lock in the filter of
> 'IPT', and then let me choose from the available fields in
> 'Tier5' and so on.
> In a nutshell, I'd like it to do what Autofilter does for an Excel
> spreadsheet, if this is possible.
>
> Thanks in advance for your time.
> -RQ[/color]