Results 1 to 3 of 3
  1. #1
    ayupchap is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Dec 2013
    Posts
    107

    Counting letters within a record?

    Hi all



    So I have creatde a database which is working great thanks to this forum! I wanted to add this functionality to it.

    I have 6 different fields within a table I want to count the letter grdes in them. For example I have student A who has one of 3 letter grade options S,E or D. Now they have 5 fields that this garde can be in Number, Measurement, Geometry, Addition And subtraction.

    How do I create a field that acts as a formula that will add all the D grades from each one? Do I use the calculated field? If so how do I get it to do what I want?

    Thanks so much


    Regards


    Scott

  2. #2
    JoeM is offline VIP
    Windows 7 32bit Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    Sounds like you may have a design issue. Instead of having 5 different fields for one record (Number, Measurement, Geometry, Addition and Subtraction), a normalized design have 5 different records, where one of the records in something like "Category" or "Subject", and these 5 options would be options listed under their, and then you would have a single field to hold Letter Grade. Then it is pretty easy to count all the D's for each person (using an Aggregate Query).

    Otherwise, you need to do a messy calculated field like:
    Code:
    Total_Ds: IIF([Number]="D",1,0) + IIF([Measurement]="D",1,0) + IIF([Geomtery]="D",1,0)  + IIF([Addition]="D",1,0)  + IIF([Subtraction]="D",1,0)
    While this may not seem like a big deal, what if you had 20 of them? Or what if you had to add another Subject (then you would need to adjust all your formulas)?

    With a well designed database, you would just be adding new records to an existing field, and wouldn't need to add new fields if you wanted to add more subjects. And it makes it much easier to work with too.

  3. #3
    alansidman's Avatar
    alansidman is offline Indifferent
    Windows 10 Access 2013
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,538
    Joe's comments are on target. To help you understand and build better designed data bases, look at this link:

    http://r937.com/relational.html

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

Similar Threads

  1. Counting the number of times a record appears
    By liamfrancis2013 in forum Access
    Replies: 1
    Last Post: 06-08-2015, 07:04 AM
  2. IIF with numbers and letters
    By hzrdc2 in forum Queries
    Replies: 2
    Last Post: 03-28-2013, 07:29 AM
  3. Have a Query only look at the last 4 letters in a name
    By matthewmessmer in forum Queries
    Replies: 3
    Last Post: 02-11-2013, 12:42 PM
  4. Specific record counting in Reports
    By Duncan in forum Reports
    Replies: 2
    Last Post: 11-08-2012, 02:54 PM
  5. Counting fields in a single record
    By Racingrl in forum Queries
    Replies: 2
    Last Post: 06-11-2012, 10:52 AM

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