Results 1 to 11 of 11
  1. #1
    djclntn is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Feb 2011
    Posts
    476

    How to calculate # of first letters of names in a field

    I’m sorry, but I don’t know how to write out the query I’m trying to create so I’ll create an example:

    Field: Drivers Names
    I want to know how to create a query that will calculate the # of “drivers names” which starts with, “A”, “B”, “C” etc.“
    I want my query to be:

    Drivers’ names first letter # of first letters
    A 10
    B 19
    C 15


    Can anyone know & tell me how I can create such a query
    Thanks

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,640
    Try

    SELECT Left(DriverNameField, 1) As FirstLetter, Count(*) As HowMany
    FROM TableName
    GROUP BY Left(DriverNameField, 1)
    ORDER BY Left(DriverNameField, 1)
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    djclntn is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Feb 2011
    Posts
    476
    I'm sorry, mightt you provide me with some more precise step-by-step details as to creating such a query?
     
     
    Thanks.

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Open a new query in design mode and switch to SQL View. Copy and Paste what Paul provided and replace DriverNameField with the name of your field. Then switch to Datasheet View and see what you get.

  5. #5
    djclntn is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Feb 2011
    Posts
    476
    Heres' what I tried,

    SELECT Left(Drivers, 1) As FirstLetter, Count(*) As HowMany
    FROM Series Results
    GROUP BY Left(Drivers, 1)
    ORDER BY Left(Drivers, 1)

    No luck

  6. #6
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    What do you get?

  7. #7
    djclntn is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Feb 2011
    Posts
    476
    Cnnot find 'Series' in Tables or Queries

  8. #8
    djclntn is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Feb 2011
    Posts
    476
    I figured it out! Thanks a lot!!!

  9. #9
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    We're glad we could help.

  10. #10
    djclntn is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Feb 2011
    Posts
    476
    Hey,

    I don't mean to overkill here, but you REALLY help me out! Thanks Again!

  11. #11
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Both Paul and I appreciate your sentiments. That's why we hang out here. You are very welcome.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. TransferSpreadsheet - Use first row as field names
    By jgelpi16 in forum Programming
    Replies: 1
    Last Post: 02-23-2011, 11:41 AM
  2. Replies: 5
    Last Post: 12-17-2010, 11:06 AM
  3. Calculate one field based on another one
    By Douglasrac in forum Forms
    Replies: 7
    Last Post: 11-18-2010, 01:30 PM
  4. using like with field names
    By TheShabz in forum Queries
    Replies: 4
    Last Post: 10-07-2010, 05:11 PM
  5. Quick way to stuff field names into text field
    By kfinpgh in forum Programming
    Replies: 0
    Last Post: 01-04-2007, 01:13 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums