A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Subform sort order problem



 
 
Thread Tools Display Modes
  #1  
Old May 2nd, 2007, 12:13 PM posted to microsoft.public.access.forms
Anthony Spatuzzi
external usenet poster
 
Posts: 2
Default Subform sort order problem

I have a form/subform. They are linked on the field 'cnum'. The fields in
the table 'Received' which is what the subform is bound to a

Cnum
Ldate
Lbs
Furniture
Clothes
Council

The 'OrderBy' = received.ldate DESC
and 'OrderByOnLoad' = yes

However, when subform opens the records are sorted in ascending order.

To check this I put the following into the 'Current' event of the form:

Debug.Print Me.OrderBy, Me.OrderByOn, Me.OrderByOnLoad

The results of this a

ldate DESC False True
ldate DESC False True
ldate DESC False True
ldate DESC False True


In order for it to sort in the descending order, I put the following into
the 'Current' event of the form:
Me.OrderByOn = True

which yields:

ldate DESC False True
ldate DESC True True
ldate DESC True True
ldate DESC True True
ldate DESC True True

One point which may be of importance is that I took this form and most
every object from a corrupted dB using the technique outlined by Allen
Browne. I also was fairly certain that I did not pull the corrupting form
into the new dB.

Thanks
  #2  
Old May 2nd, 2007, 02:18 PM posted to microsoft.public.access.forms
Roger Carlson
external usenet poster
 
Posts: 824
Default Subform sort order problem

Instead of applying the sort to the form, why not create a sorted
recordsource for the form, that is, create a query as the record source for
the subform and sort it there.

--
--Roger Carlson
MS Access MVP
Access Database Samples: www.rogersaccesslibrary.com
Want answers to your Access questions in your Email?
Free subscription:
http://peach.ease.lsoft.com/scripts/...UBED1=ACCESS-L

"Anthony Spatuzzi" wrote in message
...
I have a form/subform. They are linked on the field 'cnum'. The fields in
the table 'Received' which is what the subform is bound to a

Cnum
Ldate
Lbs
Furniture
Clothes
Council

The 'OrderBy' = received.ldate DESC
and 'OrderByOnLoad' = yes

However, when subform opens the records are sorted in ascending order.

To check this I put the following into the 'Current' event of the form:

Debug.Print Me.OrderBy, Me.OrderByOn, Me.OrderByOnLoad

The results of this a

ldate DESC False True
ldate DESC False True
ldate DESC False True
ldate DESC False True


In order for it to sort in the descending order, I put the following into
the 'Current' event of the form:
Me.OrderByOn = True

which yields:

ldate DESC False True
ldate DESC True True
ldate DESC True True
ldate DESC True True
ldate DESC True True

One point which may be of importance is that I took this form and most
every object from a corrupted dB using the technique outlined by Allen
Browne. I also was fairly certain that I did not pull the corrupting form
into the new dB.

Thanks



  #3  
Old May 3rd, 2007, 12:49 AM posted to microsoft.public.access.forms
Anthony Spatuzzi
external usenet poster
 
Posts: 2
Default Subform sort order problem

On Wed, 2 May 2007 09:18:19 -0400, Roger Carlson wrote:

Instead of applying the sort to the form, why not create a sorted
recordsource for the form, that is, create a query as the record source for
the subform and sort it there.


I must have misstated the question. In code I can get it to sort correctly
by setting the 'Me.OrderByOn = true' in the oncurrent event of the form.
However, this should not be necessary as I have used this form/subform
combination before and it behaves as I desire ie; if I want an ascending
sort I get an ascending sort and if I want a descending sort I get a
descending sort via the form's properties.

The output of the debug.print shows that the 'orderby' property is false
when it should be true.

Thanks
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 01:11 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.