PDA

View Full Version : Sorting Access Data by First Charecter


crashed29
10-18-2005, 12:45 AM
I am putting a company directory online that will pull from an access database. I need to be able to pull the names by last name first charecter. For example, if someone clicks on "a", then it will list all the people in the company that last name starts with an a.

Any ideas?

Thanks!

Freon22
10-18-2005, 02:13 AM
Yes you can do that with your query.

sql = "select lastname from yourtable where lastname LIKE '" & letter & "%';"

Here is a good link that will help you alot.

http://www.sqlcourse.com/

Its a good Interactive SQL tutorial.

Brandoe85
10-18-2005, 04:59 PM
You could use the LEFT() function:

SELECT fields FROM table WHERE LEFT(lastname, 1) = YourLetter


Good luck