By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,461 Members | 2,184 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,461 IT Pros & Developers. It's quick & easy.

Sort a form by default

P: n/a
Hi all,

I have a form which is based on a table.

The table (table1) has fields like Surname, Firstname, etc.

I want to have the form sort by Surname, and then Firstname.

I put the Orderby files as "table1.surname, table1.firstname", and all
is fine. The along comes somebody and clicks a field, and clicks the
A-Z button to sort it by that field, and from then on it is sorted by
that field. I don't want to disable this button as it is useful to
beable to do it to this field, I don't have a way which is just as
easy to sort it by Surname,Firstname again. If they click on the
Surname field and click A-Z, surname is sorted, but the firstnames if
the surname is the same aren't necessary sorted, and you can't seem to
click to fileds and tell it to sort...

So, can I (somehow) make a button on the form so if they click on
that, it will sort by Surname, Firstname again? and if so... how
(please).

Thanks for reading.
Max.
Nov 12 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Max Harvey wrote:
Hi all,

I have a form which is based on a table.

The table (table1) has fields like Surname, Firstname, etc.

I want to have the form sort by Surname, and then Firstname.

I put the Orderby files as "table1.surname, table1.firstname", and all
is fine. The along comes somebody and clicks a field, and clicks the
A-Z button to sort it by that field, and from then on it is sorted by
that field. I don't want to disable this button as it is useful to
beable to do it to this field, I don't have a way which is just as
easy to sort it by Surname,Firstname again. If they click on the
Surname field and click A-Z, surname is sorted, but the firstnames if
the surname is the same aren't necessary sorted, and you can't seem to
click to fileds and tell it to sort...

So, can I (somehow) make a button on the form so if they click on
that, it will sort by Surname, Firstname again? and if so... how
(please).

Thanks for reading.

Max.


I'll assume this is a single form or continuous as you can multiselect
columns in a datasheet. You could create a command button then shrink it
down until it's the same height of the surname contol and very narrow.
Maybe put in an S (for sort) as it's caption. Put it to the left of the
label for Surname. In the OnClick event enter
Me.OrderBy = "Surname, FirstName"
Me.OrderByOn = True
Nov 12 '05 #2

P: n/a
Max,
Base the form on a query sorted by LastName, FirstName.
This then becomes the 'normal' sort for the form.

If someone re-sorts, using the A-Z or Z-A toolbuttons,
simply by right-clicking anywhere within the form and selecting
'Remove Filter/Sort' you'll be back where you want to be.
Or ...
you can click on Records + Remove Filter/Sort.

--
Fred

Please reply only to this newsgroup.
I do not reply to personal e-mail.
"Max Harvey" <go****@DELTAL.org> wrote in message
news:7a**************************@posting.google.c om...
Hi all,

I have a form which is based on a table.

The table (table1) has fields like Surname, Firstname, etc.

I want to have the form sort by Surname, and then Firstname.

I put the Orderby files as "table1.surname, table1.firstname", and all
is fine. The along comes somebody and clicks a field, and clicks the
A-Z button to sort it by that field, and from then on it is sorted by
that field. I don't want to disable this button as it is useful to
beable to do it to this field, I don't have a way which is just as
easy to sort it by Surname,Firstname again. If they click on the
Surname field and click A-Z, surname is sorted, but the firstnames if
the surname is the same aren't necessary sorted, and you can't seem to
click to fileds and tell it to sort...

So, can I (somehow) make a button on the form so if they click on
that, it will sort by Surname, Firstname again? and if so... how
(please).

Thanks for reading.
Max.

Nov 12 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.