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  

Sorting Buttons (VBA)



 
 
Thread Tools Display Modes
  #1  
Old March 3rd, 2010, 06:45 PM posted to microsoft.public.access.forms
szag via AccessMonster.com
external usenet poster
 
Posts: 99
Default Sorting Buttons (VBA)

I am struggling with creating commdand buttons for sorting on a field. Here
are the codes in the two buttons:

ascending sort button...
Me.OrderBy = "[Vendor_JE]"
Me.OrderByOn = True

descending sort button...
Me.OrderBy = "[Vendor_JE]Desc"
Me.OrderByOn = True

The ascending button seems to work. My question is why isn't the descending
button working and how to do clear out the OrderBy in the forms property.
Thanks!

--
Message posted via http://www.accessmonster.com

  #2  
Old March 3rd, 2010, 07:41 PM posted to microsoft.public.access.forms
Daryl S[_2_]
external usenet poster
 
Posts: 881
Default Sorting Buttons (VBA)

szag -

Put a space between the fieldname and Desc:

Me.OrderBy = "[Vendor_JE] Desc"

--
Daryl S


"szag via AccessMonster.com" wrote:

I am struggling with creating commdand buttons for sorting on a field. Here
are the codes in the two buttons:

ascending sort button...
Me.OrderBy = "[Vendor_JE]"
Me.OrderByOn = True

descending sort button...
Me.OrderBy = "[Vendor_JE]Desc"
Me.OrderByOn = True

The ascending button seems to work. My question is why isn't the descending
button working and how to do clear out the OrderBy in the forms property.
Thanks!

--
Message posted via http://www.accessmonster.com

.

  #3  
Old March 3rd, 2010, 07:41 PM posted to microsoft.public.access.forms
PieterLinden via AccessMonster.com
external usenet poster
 
Posts: 307
Default Sorting Buttons (VBA)

szag wrote:
I am struggling with creating commdand buttons for sorting on a field. Here
are the codes in the two buttons:

ascending sort button...
Me.OrderBy = "[Vendor_JE]"
Me.OrderByOn = True

descending sort button...
Me.OrderBy = "[Vendor_JE]Desc"
Me.OrderByOn = True

The ascending button seems to work. My question is why isn't the descending
button working and how to do clear out the OrderBy in the forms property.
Thanks!


Is that a typo? Looks like you don't have a space between your sort field
and the sort direction
"[Vendor_JE] DESC" === extra spaces for clarity...

--
Message posted via http://www.accessmonster.com

  #4  
Old March 4th, 2010, 02:38 PM posted to microsoft.public.access.forms
szag via AccessMonster.com
external usenet poster
 
Posts: 99
Default Sorting Buttons (VBA)

Perfect - Thanks.

Daryl S wrote:
szag -

Put a space between the fieldname and Desc:

Me.OrderBy = "[Vendor_JE] Desc"

I am struggling with creating commdand buttons for sorting on a field. Here
are the codes in the two buttons:

[quoted text clipped - 10 lines]
button working and how to do clear out the OrderBy in the forms property.
Thanks!


--
Message posted via http://www.accessmonster.com

 




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 12:50 AM.


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