Re: Form's datasheet view - sort order problem

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: Van T. Dinh (VanThien.Dinh_at_discussions.microsoft.com)
Date: 10/18/04


Date: Mon, 18 Oct 2004 23:28:35 +1000

Normally, the OrderBy Property contains the Names of the Fields you want to
sort by (ascending sort; for descending add the keyword DESC).

When you set it to empty String, it has no Field to sort by, hence no
sorting by the Form but there still the sorting in the Query / SQL String if
applicable.

You certainly can use the Form_Load Event. The difference is that Brett's
and my suggestion (Unload Event) tried to remove the sorting when the Form
is closed so that no (Form's) sorting is saved with the Form so that when
the Form is opened again, there is no (Form's) sorting. Using the Form_Load
Event means that the sorting is saved with the Form but then you remove the
sorting in the Form_Load Event.

Not sure why the Unload Event doesn't work for you, though.

-- 
HTH
Van T. Dinh
MVP (Access)
"Simon Wong" <SimonWong@discussions.microsoft.com> wrote in message
news:74B324D4-04AC-4BA3-8F3B-59769A91919C@microsoft.com...
> Hi Brett and Van
>
> I have tried Brett's suggestion but of no help.
> Then I do some experiments and happened to get to the following to solve
the
> problem.
>
> In the Form's property *** I go to the OnLoad property
> and put a macro there to Set Value for Orderby = ""
>
> Then I open the form in data*** view,
> the data are sort in original order,
> I perform some sorting by A-Z or Z-A button on serveral columns
> Then I close the form and the next time I open it
> the sorting returns to the original setting,
> and those settings done in previous actions are cancel.
> The above is tried many times and it works.
> and the problem seems solved.
>
> I wish to thank you for bringing to me the "Orderby" and "On Load" terms.
> In fact what does OrderBy = "" implies?
> And if the above has any downside to the form.
>
>
> Best regards
> Simon Wong
>
>

Quantcast