Oct 17 2007, 09:47 PM
Hi, wonderful UA folks--
would like to add two buttons to help my user manage the results of a search:
1) a button to toggle between A-Z and Z-A sorting on the column in which they have clicked. (If toggling isn't possible, I'm willing to add two separate buttons for ascending and descending sort.)
2) a button to ZOOM into the cell they have clicked. (To view the full contents of a long cell without resizing the column.)
Oknow 1) can be done with the toolbar buttons and through the right-click menu, and 2) can be done with SHIFT-F2. However, my user is not comfortable with databases, and if possible, these buttons would make my form a lot easier for her to use.
I'm attaching the database, please let me know if I've done so incorrectly.
Thanks very much,
Oct 17 2007, 09:52 PM
I'm sorry, I should have mentioned that I would like to put the buttons on the form frm_main.
Oct 17 2007, 10:29 PM
I use DoCmd.RunCommand acCmdZoomBox in the
double click event of the textbox I want to zoom.
oing the same from a command button on another form
makes things a bit more involved.
Same goes for your sorting requirements.
DoCmd.RunCommand acCmdSortAscending will sort the column
that has the focus. Doing the same from a command button
on another form would be a bit more involved.
Oct 18 2007, 03:12 PM
Thanks for your help! I like the double-click event for zooming, that works nicely.
Hmm, yeah, when I try to put DoCmd.RunCommand acCmdSortAscending in the Event Procedure of a button on my main form, I get the error "The command or action 'SortAscending' isn't available now." when I click it.
Can I say something like:
DoCmd.RunCommand acCmdSortAscending Me.sbf_preorder ?
I'm at the 'struggling to learn VBA' stage, so I don't know the correct syntax...
Oct 18 2007, 05:50 PM
I have never actually implemented sorting in this particular way
before so this seems to work , but is not very well tested.
Private Sub cmd_preorder_sorttoggle_Click()
If .Caption = "Sort Ascending" Then
.Caption = "Sort Descending"
.Caption = "Sort Ascending"
Oct 18 2007, 10:03 PM
ow...that works perfectly! Very cool code, thanks so much.
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here