Sorting of records

Hellfire

Registered User.
Local time
Today, 22:48
Joined
Jul 23, 2002
Messages
57
Hi All,

I have a form that I use to display ALL the records in a table. I use the same form, but with a filter to display only certain records.

I have two different buttons on my switchboard that I use to open the form with, one opens the form as it is, the other applies a filter to the "Collected by" field of the form.

My Table is Called tbl_IN and I have a date and time field on there that I want the records to be sorted by.

In the "Sort By" field of the form, I have:
[tbl_IN].[Date],[tbl_IN].[Time]

This seems to do the thing perfectly.

HOWEVER,

After a while, I am at present not sure why this happens or when, but, after a while, the "sort By" changes it self to:
[tbl_IN].[Collected by],[tbl_IN].[Date],[tbl_In].[Time]

And then the whole sorting goes Alphgabetical acording to the person who collected it, rather than by date and time.

Is there a way of forcing the form, even with a filter applied, to ALWAYS sort by the fields I want it to, ie. Date and Time?

Please help if you can,
Thanks
H
 
You can force the form to sort the way you like with code. Just put the code below on OnLoad event.

Private Sub Form_Open(Cancel As Integer)
Me.OrderBy = "[Date], [Time]"
Me.OrderByOn = True
End Sub

And do not name the fields with reserved words like Date, Time, Name, ect.
 
One thing I wonder about is whether two folks are accessing this table at once, one by "all" option and the other by "user" option. If the db isn't split, then two users can access the form at the same time but depending on how the ordering is imposed by your code, if the "by person" viewer comes in first, the "see all" viewer might be seeing the filter that the other person sees.

If the DB were split into FE/BE and everyone had a local copy of the FE file, this wouldn't happen. Other ugly things (like really bad performance) MIGHT happen. But at least a local sort order won't affect other users.
 

Users who are viewing this thread

Back
Top Bottom