Remove sort and filters programmatically on form

  • Follow


I have a form based on a 2 table query.  User will use shortcut menu to 
filter records down to what they want to work on and sort accordingly.  I 
have a button to remove all filters but I also want to remove any sorts that 
were applied and I can't seem to get that part to work.  I use the following 
to remove all the filters.  I just need help with the code to get the form 
back to the original underlying query sort.

On_Click event of button control
Me.Filter = ""
FilterOn = False

Like I said, this brings back all records but the sort stays.
I am using Access 2007

Any help is greatly appreciated.

Wally
0
Reply Utf 4/6/2010 5:01:12 PM

"wallymeister" <wallymeister@discussions.microsoft.com> wrote in message 
news:58A40704-3438-4B3A-8E12-89AA80A10AD9@microsoft.com...
>I have a form based on a 2 table query.  User will use shortcut menu to
> filter records down to what they want to work on and sort accordingly.  I
> have a button to remove all filters but I also want to remove any sorts 
> that
> were applied and I can't seem to get that part to work.  I use the 
> following
> to remove all the filters.  I just need help with the code to get the form
> back to the original underlying query sort.
>
> On_Click event of button control
> Me.Filter = ""
> FilterOn = False
>
> Like I said, this brings back all records but the sort stays.
> I am using Access 2007


Me.OrderBy = ""
Me.OrderByOn = False


-- 
Dirk Goldgar, MS Access MVP
Access tips: www.datagnostics.com/tips.html

(please reply to the newsgroup)

0
Reply Dirk 4/6/2010 5:09:44 PM


Thanks Dirk, I swear I tried that before and it didn't work so I thought 
there might be something different with 2007, but it worked this time so I 
must have done something wrong.

Thanks again
Wally

"Dirk Goldgar" wrote:

> "wallymeister" <wallymeister@discussions.microsoft.com> wrote in message 
> news:58A40704-3438-4B3A-8E12-89AA80A10AD9@microsoft.com...
> >I have a form based on a 2 table query.  User will use shortcut menu to
> > filter records down to what they want to work on and sort accordingly.  I
> > have a button to remove all filters but I also want to remove any sorts 
> > that
> > were applied and I can't seem to get that part to work.  I use the 
> > following
> > to remove all the filters.  I just need help with the code to get the form
> > back to the original underlying query sort.
> >
> > On_Click event of button control
> > Me.Filter = ""
> > FilterOn = False
> >
> > Like I said, this brings back all records but the sort stays.
> > I am using Access 2007
> 
> 
> Me.OrderBy = ""
> Me.OrderByOn = False
> 
> 
> -- 
> Dirk Goldgar, MS Access MVP
> Access tips: www.datagnostics.com/tips.html
> 
> (please reply to the newsgroup)
> 
0
Reply Utf 4/6/2010 6:39:20 PM

2 Replies
1001 Views

(page loaded in 0.075 seconds)

Similiar Articles:
















7/24/2012 9:48:42 AM


Reply: