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!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top