Sorting columns in Datasheet view

J

Jerry Crosby

I want to create a form with, say 4 columns, set up in Datasheet view. The
user needs to be able to sort the data on any of the four columns.

I know that if you put the cursor in a column, then click the "A-to-Z" or
"Z-to-A" button in the toolbar, it will sort by that column.

Rather than instruct the user to go to the toolbar icon, I'd like to add
buttons to the form that might say, "Sort Last Name", "Sort Age", "Sort
Zip", etc.

However, any button I place in the form header or page header doesn't show
up when I set the view to Datasheet view. So, question #1 is: Do I have to
use continuous forms view in order to use buttons in the header?

Second question: what is the code I'd put behind the button to sort by the
selected column? I believe it is the "order" function, but that's where my
knowledge stops!

thanks.

Jerry
 
T

tina

comments inline.

Jerry Crosby said:
I want to create a form with, say 4 columns, set up in Datasheet view. The
user needs to be able to sort the data on any of the four columns.

I know that if you put the cursor in a column, then click the "A-to-Z" or
"Z-to-A" button in the toolbar, it will sort by that column.

Rather than instruct the user to go to the toolbar icon, I'd like to add
buttons to the form that might say, "Sort Last Name", "Sort Age", "Sort
Zip", etc.

However, any button I place in the form header or page header doesn't show
up when I set the view to Datasheet view. So, question #1 is: Do I have to
use continuous forms view in order to use buttons in the header?
yes. the form header/footer sections are not visible in Datasheet form view.
Second question: what is the code I'd put behind the button to sort by the
selected column? I believe it is the "order" function, but that's where my
knowledge stops!

if you want to keep your Datasheet view, your users can simply right click
on any column and choose a Sort option from the Shortcut menu. the Sort
operation will be performed on the column that was "right-clicked". if you
don't want your users to have access to the other built-in options on the
default shortcut menu, an alternative solution would be to create a custom
Shortcut menu (drop menu that opens on right click anywhere in the form
view) that includes only the Sort menu options from the built-in Access
menu. then just assign that custom shortcut menu to the form. it's quick,
easy, and requires no coding.

hth
 

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