Sorting Buttons (VBA)

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

szag via AccessMonster.com

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!
 
D

Daryl S

szag -

Put a space between the fieldname and Desc:

Me.OrderBy = "[Vendor_JE] Desc"
 
P

PieterLinden via AccessMonster.com

szag said:
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...
 
S

szag via AccessMonster.com

Perfect - Thanks.

Daryl said:
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!
 
Top