473,385 Members | 1,343 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,385 software developers and data experts.

Drop down list in Access

18
Hi

Help plz, I have a combo box with names in: -

E.G

DR A Bloggs
DR A B Smith
DR A B C Another
DR B F Able
DR F S Norman

What I’m wanting to achieve is to sort the list by Surname ignoring the Title, and other forename characters, but still want to display them.

Not sure which is the best way to do this e.g VB???

P.S I am developing the database in MS Access 2002

Thanks in advance!!

Andy
Feb 28 '08 #1
4 1826
Scott Price
1,384 Expert 1GB
If your table is designed as it should be (i.e. with name data separated into a First Name, Last Name and Title field) you will have no problem.
Expand|Select|Wrap|Line Numbers
  1. SELECT [Title] & " " & [FirstName] & " " & [LastName] AS Doctor
  2. FROM TableDoctor
  3. ORDER BY TableDoctor.LastName;
  4.  
Should do the trick.

Regards,
Scott
Feb 28 '08 #2
AJHY
18
Hi

Thanks for the quick responce, ah well the database I am currently working on I have inherited from another designer.

All the names are contained within the same field. Therefore I have a problem.

Thanks

Andy
Feb 28 '08 #3
Scott Price
1,384 Expert 1GB
Hi Andy,

My suggestion is to restructure your table according to accepted database design principles before going any further.

And no, it's not acceptable to not re-structure just because someone else created the design in the first place.

VBA is remarkably flexible, and it is possible to split the name and sort it as you wish. However, this is NEVER acceptable in my opinion! Using VBA to compensate for bad design is a bankrupt policy.

It's a simple matter to add two columns to your existing table. It breaks nothing, and fixes your problem. You might feel a bit daunted at thinking of re-entering the existing data, and possibly restructuring the queries that enter the data in the first place, but, TRUST ME... you will find it far easier in the long run to do it right than continue attempting to fight with an improperly designed database.

Regards,
Scott
Feb 28 '08 #4
NeoPa
32,556 Expert Mod 16PB
Acceptable or not, there's really no practicable way to sort by a surname when that surname is not the start (or even n chars in) of a field.
The suggestion to separate the data into individual fields seems to be your best (only) choice.
Mar 3 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Ken | last post by:
Hi I have a CRM system which is based on access. We use this system to automatically create all our offers and invoices etc. The problem is the offers usually look quite absurd as we have no...
0
by: Dec | last post by:
Ok to simplify things I'll just give an example. This is pretty much what I want to do (minus the postcode): http://www.perrys.co.uk/usedcar?ID=F5J9BNNBMVK00DF I have relatively little...
1
by: Dec | last post by:
Ok to simplify things I'll just give an example. This is pretty much what I want to do (minus the postcode): http://www.perrys.co.uk/usedcar?ID=F5J9BNNBMVK00DF I have relatively little...
2
by: kmnotes04 | last post by:
Is it possible to link one drop-down box to another? For example, if a name is chosen from a drop-down list, can another drop-down list then automatically display the person's office as a result of...
2
by: Yoshitha | last post by:
hi I have 2 drop down lists in my application.1st list ontains itmes like java,jsp,swings,vb.net etc.2nd list contains percentage i.e it conatains the items like 50,60,70,80,90,100. i will...
3
by: Yi Chen | last post by:
We have a drop down list on a PHP page, with several product names, and when people click one item, we will refresh the same page with the product name as parameter, and in turn we want to include...
3
by: penny111 | last post by:
Hi there, For my application, i need to have 3 drop down lists 1. drop down list of folder names 2. drop down list of documents in the folder selected 3. drop down list of instances of the...
4
by: jack.vier | last post by:
I have a table that I am manipulating as a table, not as a form. Is it possible to have a drop down list in a table? I came across this:...
2
by: Doug | last post by:
Hi, I can't figure out how to create a drop-down list box. The help file says it exists. The icon in the help file matches the combobox in the toolbox. I tried using a combox box, both with and...
3
by: DaveRook | last post by:
Hi I am using C# and Access databse for a web site. I have a drop down list which I need to populate dynamically according to results in a database. Example There will be 1 drop down list...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: 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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.