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. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
sort button
I have a datasheet form that I would like to click on the column header and
then click on a button (a to z) or (z to a) that will sort the data in either ascending or descending order. This is simple if I leave the toolbar enabled but I would like to do this with a command button. I'm not a programmer and have little understanding of module etc. Any advice |
#2
|
|||
|
|||
sort button
On Tue, 9 Feb 2010 13:19:02 -0800, john wrote:
I have a datasheet form that I would like to click on the column header and then click on a button (a to z) or (z to a) that will sort the data in either ascending or descending order. This is simple if I leave the toolbar enabled but I would like to do this with a command button. I'm not a programmer and have little understanding of module etc. Any advice Simply Right-click on the column header and select Sort Ascending or Sort Descending from the shortcut menu. Or if you must create your own code you can't use the column header. You can code "each" control's double-click event: If Me.OrderBy = "[ThisFieldName] Desc" then Me.OrderBy = "[ThisFieldName]" Else Me.OrderBy = "[ThisFieldName] Desc" End If Me.OrderByOn = True Change ThisFieldName to whatever the actual name of the field is. Make sure it's within brackets and quotes as above. Click on the actual control to re-sort when wanted, not on the column header. Click a second time to re-sort again. -- Fred Please respond only to this newsgroup. I do not reply to personal e-mail |
#3
|
|||
|
|||
sort button
Fred has given you some good approaches, including the double-click event of
your textboxes. The reason he suggested using this approach is that you cannot have Command Buttons on a Datasheet View Forms, only on Single View Forms or Continuous View Forms! -- There's ALWAYS more than one way to skin a cat! Answers/posts based on Access 2000/2003 Message posted via http://www.accessmonster.com |
#4
|
|||
|
|||
sort button
THANKS!!!
"fredg" wrote: On Tue, 9 Feb 2010 13:19:02 -0800, john wrote: I have a datasheet form that I would like to click on the column header and then click on a button (a to z) or (z to a) that will sort the data in either ascending or descending order. This is simple if I leave the toolbar enabled but I would like to do this with a command button. I'm not a programmer and have little understanding of module etc. Any advice Simply Right-click on the column header and select Sort Ascending or Sort Descending from the shortcut menu. Or if you must create your own code you can't use the column header. You can code "each" control's double-click event: If Me.OrderBy = "[ThisFieldName] Desc" then Me.OrderBy = "[ThisFieldName]" Else Me.OrderBy = "[ThisFieldName] Desc" End If Me.OrderByOn = True Change ThisFieldName to whatever the actual name of the field is. Make sure it's within brackets and quotes as above. Click on the actual control to re-sort when wanted, not on the column header. Click a second time to re-sort again. -- Fred Please respond only to this newsgroup. I do not reply to personal e-mail . |
Thread Tools | |
Display Modes | |
|
|