sort order in subform

  • Thread starter Thread starter Slez via AccessMonster.com
  • Start date Start date
S

Slez via AccessMonster.com

In a subform, I have 2 fields: RoomNumber and ItemNumber.
It is in datasheet view and the Record Source is the table "Item".
In the Order By property, I have: Item.RoomNumber, Item.ItemNumber

It does not retain that sort order as ascending. Users can highlight and
sort on their own, but it does not hold the order that it was sorted in when
users go back into the database.

Any ideas what might be my problem? Thanks in advance for feedback!
 
Hi Slez,

I don't understand what you want. Do you want the sub form to 'remember'
the most recent sort order or do you want the sub form to revert to the
original design sort order every time it is loaded?

Regards,

Rod
 
Sorry for the confusion. I want it to revert to the original design sort
order every time it is loaded.
Thanks again!
Slez

Rod said:
Hi Slez,

I don't understand what you want. Do you want the sub form to 'remember'
the most recent sort order or do you want the sub form to revert to the
original design sort order every time it is loaded?

Regards,

Rod
In a subform, I have 2 fields: RoomNumber and ItemNumber.
It is in datasheet view and the Record Source is the table "Item".
[quoted text clipped - 5 lines]
Any ideas what might be my problem? Thanks in advance for feedback!
 
Hi Slez,

You have two choices: reset the sort order upon form close or upon form
load. I tend to use the Load event. Here is an extract from one of my
projects.

Private Sub Form_Load()
Me.OrderBy = "SortKey"
End Sub

You need to substitute your particular desired sequence for SortKey above.
You will suffer a slight performance hit as the statement will cause a
requery - I suppose you could always test the value of the property and onlt
reset it if it differs from what you want thus avoiding unnecessary requeries.

If nothing happens then you may have to enable OrderByOn; it is possible for
the user to disable this property and the setting is persistent between
sessions. I don't know whether enabling OrderByOn itself causes a requery, I
suppose it must.

Here then is a question for anyone else expert in this topic: If OrderByOn
is already enabled, does OrderByOn = True cause a requery?

Regards,

Rod

Slez via AccessMonster.com said:
Sorry for the confusion. I want it to revert to the original design sort
order every time it is loaded.
Thanks again!
Slez

Rod said:
Hi Slez,

I don't understand what you want. Do you want the sub form to 'remember'
the most recent sort order or do you want the sub form to revert to the
original design sort order every time it is loaded?

Regards,

Rod
In a subform, I have 2 fields: RoomNumber and ItemNumber.
It is in datasheet view and the Record Source is the table "Item".
[quoted text clipped - 5 lines]
Any ideas what might be my problem? Thanks in advance for feedback!
 
Back
Top