473,396 Members | 2,024 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Sort a form by default

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
2 13771
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Shixx | last post by:
Hello, I have problem in my web application and my web form. I have 5-6 buttons (web controls) and when I have focus on some text box, always one button becomes default and got focus, and after I...
88
by: Mike | last post by:
Is there a way to determine what a user's default email client is? I read a post from 3 years ago that said no. I guess I'm hoping something has come along since then.
5
by: serge | last post by:
How can i enter Default Values of " " to all the columns of type character of all the tables (excluding system tables) and Default Values of 0 of all columns of type numbers. Excluding all primary...
2
by: Yeah | last post by:
I have a simple fill-out form with three fields, in this order: Name, E-mail, and Comment. But when I receive the E-mail containing the form data, the fields are listed backwards (Comment, E-mail,...
48
by: Alex Chudnovsky | last post by:
I have come across with what appears to be a significant performance bug in ..NET 2.0 ArrayList.Sort method when compared with Array.Sort on the same data. Same data on the same CPU gets sorted a...
3
by: afr0ninja | last post by:
Hello! I'm currently working on a form that has several input fields and a subform. What I'm trying to accomplish is that when I first open the form I'd like to have the input fields displayed...
49
dima69
by: dima69 | last post by:
Hi all. Here is a problem. I want to sort a form by absolute value. Let's say, if I have a field named "theSum", I'd like to set the form OrderBy property to "Abs()". If I use "Advanced...
5
by: Nirmala123 | last post by:
hi... I want to sort the table using combobox values. I give the code here. address.html: <html> <head> <title>Add a new entry</title> </head>
2
by: curran.george | last post by:
'add one textbox to form1 with Control Source property = ID 'copy/paste the form_load code below: 'Then open the form and then attempt to sort the datasheet 'crashes 2003, error 3450 Access 2007 -...
11
by: Ezzz | last post by:
Initially all the assets in my form were ordered by the product Id. (Not set by me suspect it is some sort of default after i downloaded the database?) In order to keep all similar assets together...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.