Sorting

J

Joan

Hi,
I have a form (in datasheet view) that most of the time, I'd like sorted by
[Breed] ASC and then by [Sex] DESC. I have the following expression for
the ORDER By property in the property sheet of the form:
EnterStoresQuery.[Breed]; EnterStoresQuery.[Sex] DESC. However, the user
may from time to time like to sort it by [Dog Number] or some other field.
When they do this, the form remains sorted in the sort order the user used
last. Is there a way to make the form automatically revert back to a
default sort order: EnterStoresQuery.[Breed]; EnterStoresQuery.[Sex] DESC
when the user either moves the focus off of the form, closes the form or
some other determined time?

Joan
 
S

SteveD

on the onClose event of the form try adding

RunCommand acCmdRemoveFilterSort

This will return the sorting back to the original.

HTH
SteveD
 
J

Joan

Steve,
I tried using: DoCmd.RunCommand acCmdRemoveFilterSort on the OnClose
event of the form like you suggested. However, when I then close the form
and re-open it the form does not show the default sort order, but the order
the user last applied. Now if I switch to Design View and then back , then
the default sort order shows like it should. The user will not be looking
or working with the Design view of the form however, so what do I need to
do? Put this line of code in another event?

Joan

SteveD said:
on the onClose event of the form try adding

RunCommand acCmdRemoveFilterSort

This will return the sorting back to the original.

HTH
SteveD

-----Original Message-----
Hi,
I have a form (in datasheet view) that most of the time, I'd like sorted by
[Breed] ASC and then by [Sex] DESC. I have the following expression for
the ORDER By property in the property sheet of the form:
EnterStoresQuery.[Breed]; EnterStoresQuery.[Sex] DESC. However, the user
may from time to time like to sort it by [Dog Number] or some other field.
When they do this, the form remains sorted in the sort order the user used
last. Is there a way to make the form automatically revert back to a
default sort order: EnterStoresQuery.[Breed]; EnterStoresQuery.[Sex] DESC
when the user either moves the focus off of the form, closes the form or
some other determined time?

Joan


.
 
G

Gary Miller

Will Me.AllowFilters = False work?

--

Gary Miller
Gary Miller Computer Services
Sisters, OR
________________________
Joan said:
Steve,
I tried using: DoCmd.RunCommand acCmdRemoveFilterSort on the OnClose
event of the form like you suggested. However, when I then close the form
and re-open it the form does not show the default sort order, but the order
the user last applied. Now if I switch to Design View and then back , then
the default sort order shows like it should. The user will not be looking
or working with the Design view of the form however, so what do I need to
do? Put this line of code in another event?

Joan

SteveD said:
on the onClose event of the form try adding

RunCommand acCmdRemoveFilterSort

This will return the sorting back to the original.

HTH
SteveD

-----Original Message-----
Hi,
I have a form (in datasheet view) that most of the
time,
I'd like sorted by
[Breed] ASC and then by [Sex] DESC. I have the following expression for
the ORDER By property in the property sheet of the form:
EnterStoresQuery.[Breed]; EnterStoresQuery.[Sex] DESC. However, the user
may from time to time like to sort it by [Dog Number]
or
some other field.
When they do this, the form remains sorted in the sort order the user used
last. Is there a way to make the form automatically revert back to a
default sort order: EnterStoresQuery.[Breed]; EnterStoresQuery.[Sex] DESC
when the user either moves the focus off of the form, closes the form or
some other determined time?

Joan


.
 
S

SteveD

Your right - I went to look at where I have it and it is
on the "stop" button, not the OnClose event of the form.

Just for grins, I just moved it around to other events -
It works on the form OnLoad event. I put it as the last
item on my OnLoad for this form.

Sorry for the mis-cue.

SteveD
-----Original Message-----
Steve,
I tried using: DoCmd.RunCommand
acCmdRemoveFilterSort on the OnClose
event of the form like you suggested. However, when I then close the form
and re-open it the form does not show the default sort order, but the order
the user last applied. Now if I switch to Design View and then back , then
the default sort order shows like it should. The user will not be looking
or working with the Design view of the form however, so what do I need to
do? Put this line of code in another event?

Joan

SteveD said:
on the onClose event of the form try adding

RunCommand acCmdRemoveFilterSort

This will return the sorting back to the original.

HTH
SteveD

-----Original Message-----
Hi,
I have a form (in datasheet view) that most of the
time,
I'd like sorted by
[Breed] ASC and then by [Sex] DESC. I have the following expression for
the ORDER By property in the property sheet of the form:
EnterStoresQuery.[Breed]; EnterStoresQuery.[Sex] DESC. However, the user
may from time to time like to sort it by [Dog Number]
or
some other field.
When they do this, the form remains sorted in the sort order the user used
last. Is there a way to make the form automatically revert back to a
default sort order: EnterStoresQuery.[Breed]; EnterStoresQuery.[Sex] DESC
when the user either moves the focus off of the form, closes the form or
some other determined time?

Joan


.


.
 
J

Joan

Thanks, Steve. I moved it to the OnLoad event and it works beautifully.

Joan

SteveD said:
Your right - I went to look at where I have it and it is
on the "stop" button, not the OnClose event of the form.

Just for grins, I just moved it around to other events -
It works on the form OnLoad event. I put it as the last
item on my OnLoad for this form.

Sorry for the mis-cue.

SteveD
-----Original Message-----
Steve,
I tried using: DoCmd.RunCommand
acCmdRemoveFilterSort on the OnClose
event of the form like you suggested. However, when I then close the form
and re-open it the form does not show the default sort order, but the order
the user last applied. Now if I switch to Design View and then back , then
the default sort order shows like it should. The user will not be looking
or working with the Design view of the form however, so what do I need to
do? Put this line of code in another event?

Joan

SteveD said:
on the onClose event of the form try adding

RunCommand acCmdRemoveFilterSort

This will return the sorting back to the original.

HTH
SteveD


-----Original Message-----
Hi,
I have a form (in datasheet view) that most of the time,
I'd like sorted by
[Breed] ASC and then by [Sex] DESC. I have the
following expression for
the ORDER By property in the property sheet of the form:
EnterStoresQuery.[Breed]; EnterStoresQuery.[Sex] DESC.
However, the user
may from time to time like to sort it by [Dog Number] or
some other field.
When they do this, the form remains sorted in the sort
order the user used
last. Is there a way to make the form automatically
revert back to a
default sort order: EnterStoresQuery.[Breed];
EnterStoresQuery.[Sex] DESC
when the user either moves the focus off of the form,
closes the form or
some other determined time?

Joan


.


.
 

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