Robert Dunstan
Mr Data
- Local time
- Today, 12:26
- Joined
- Jun 22, 2000
- Messages
- 291
OK here's an interesting one
I have a combo box on a form which queries a table called tblEmployees. Basically it displays a list of employee names. Now this list is in no order so it displays names as they are listed in the table. In the table itself I have the field 'Name' which contains the employee's first and last name so if I was to sort ascending it would sort by the first name.
What I don't particularly want to do is alter the structure of the table to have a first name field and a last name field. So what I'm thinking of maybe doing is in the form's OnLoad event is to write some code that will firstly take the Employees recordset and loop through each record, take the name, split it between first and last name and pass it to an array. Then I would like to sort the array on the last name variable and display the result in the combo box.
So basically what I want to do is to show the following names in last name order.
Fred Smith
Joe Bloggs
This is it how it is currently displayed. I want to show it like this:
Joe Bloggs
Fred Smith
Is this possible??
I have a combo box on a form which queries a table called tblEmployees. Basically it displays a list of employee names. Now this list is in no order so it displays names as they are listed in the table. In the table itself I have the field 'Name' which contains the employee's first and last name so if I was to sort ascending it would sort by the first name.
What I don't particularly want to do is alter the structure of the table to have a first name field and a last name field. So what I'm thinking of maybe doing is in the form's OnLoad event is to write some code that will firstly take the Employees recordset and loop through each record, take the name, split it between first and last name and pass it to an array. Then I would like to sort the array on the last name variable and display the result in the combo box.
So basically what I want to do is to show the following names in last name order.
Fred Smith
Joe Bloggs
This is it how it is currently displayed. I want to show it like this:
Joe Bloggs
Fred Smith
Is this possible??