Wrox Home  
Search P2P Archive for: Go

  Return to Index  

access_asp thread: Getting the alphabet from a recordset


Message #1 by "Sverrir Gunnlaugsson" <sverrir01@r...> on Fri, 22 Mar 2002 22:11:35
Hi all

I have a table with 600 entrys ranging from A-Z but not including the 
whole alphabet.

I'm wondering is there any way to go through the whole recordset and get 
the first letters?

I'm thinking about this layout at the top of my page
A|B|C|D|E|G|H|I|K  etc. and maybe 0-9 too.

Hope you can give me some help.

Thanks in advance
Sverrir
Message #2 by "Ken Schaefer" <ken@a...> on Mon, 25 Mar 2002 11:47:52 +1100
Something like:

SELECT DISTINCT LEFT(field, 1)

perhaps

(don't know of this will work in Access though, you'll have to try it out)

Cheers
Ken

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "Sverrir Gunnlaugsson" <sverrir01@r...>
Subject: [access_asp] Getting the alphabet from a recordset


: I have a table with 600 entrys ranging from A-Z but not including the 
: whole alphabet.
: 
: I'm wondering is there any way to go through the whole recordset and get 
: the first letters?
: 
: I'm thinking about this layout at the top of my page
: A|B|C|D|E|G|H|I|K  etc. and maybe 0-9 too.
: 
: Hope you can give me some help.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Message #3 by "Zee Computer Consulting" <zee@t...> on Sat, 23 Mar 2002 14:48:40 -0800
Somthing like this may help:

    SqlString = "SELECT COUNT( left( Title,1 ) ) AS FirstLetterCount, " _
                    & " left( Title,1 ) as FirstLetter " _
                    & " FROM YourTable " _
                    & " GROUP BY left(Title,1) " _
                    & " ORDER BY 2 "

Then retrieve the recordset from this SQL string and loop through the
records to build your string.


-- Zee



----- Original Message -----
From: "Sverrir Gunnlaugsson" <sverrir01@r...>
To: "Access ASP" <access_asp@p...>
Sent: Friday, March 22, 2002 10:11 PM
Subject: [access_asp] Getting the alphabet from a recordset


> Hi all
>
> I have a table with 600 entrys ranging from A-Z but not including the
> whole alphabet.
>
> I'm wondering is there any way to go through the whole recordset and get
> the first letters?
>
> I'm thinking about this layout at the top of my page
> A|B|C|D|E|G|H|I|K  etc. and maybe 0-9 too.
>
> Hope you can give me some help.
>
> Thanks in advance
> Sverrir


Message #4 by "Sverrir Gunnlaugsson" <sverrir01@r...> on Mon, 25 Mar 2002 18:11:51
Thanks this worked perfectly for me.

Cheers
Sverrir

> Somthing like this may help:

    SqlString = "SELECT COUNT( left( Title,1 ) ) AS FirstLetterCount, " _
                    & " left( Title,1 ) as FirstLetter " _
                    & " FROM YourTable " _
                    & " GROUP BY left(Title,1) " _
                    & " ORDER BY 2 "

Then retrieve the recordset from this SQL string and loop through the
records to build your string.


-- Zee



----- Original Message -----
From: "Sverrir Gunnlaugsson" <sverrir01@r...>
To: "Access ASP" <access_asp@p...>
Sent: Friday, March 22, 2002 10:11 PM
Subject: [access_asp] Getting the alphabet from a recordset


> Hi all
>
> I have a table with 600 entrys ranging from A-Z but not including the
> whole alphabet.
>
> I'm wondering is there any way to go through the whole recordset and get
> the first letters?
>
> I'm thinking about this layout at the top of my page
> A|B|C|D|E|G|H|I|K  etc. and maybe 0-9 too.
>
> Hope you can give me some help.
>
> Thanks in advance
> Sverrir



  Return to Index