Results 1 to 9 of 9
  1. #1
    Filmnoir is offline Novice
    Windows Vista Access 2007
    Join Date
    Aug 2011
    Posts
    21

    Count Functions

    Hi there,

    I have a table which contains a list of fields that are skills against employees names.



    Each skill has the value of B, I or E.

    I need a query function to count each B, I & E in each skill set and then to create a table to store them to use in a report. In this created table I need to be able to query to produce percentages to then use in the report.

    Any pointers would be appreciated?

  2. #2
    Filmnoir is offline Novice
    Windows Vista Access 2007
    Join Date
    Aug 2011
    Posts
    21
    Still struggling on this one, any ideas?

  3. #3
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,848
    Please tell us the names of your tables and the fields each table contains.
    Perhaps you could show us a jpg of your tables and relationships.

  4. #4
    Filmnoir is offline Novice
    Windows Vista Access 2007
    Join Date
    Aug 2011
    Posts
    21
    Here is what I have so far...

  5. #5
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    Your report appears to be doing exactly what you want, though you've only put in three field's worth of data. Why would you want to create a table when you're doing what you want with a report. Or are you not getting the results you want? (if you aren't I'm misunderstanding your question)

  6. #6
    Filmnoir is offline Novice
    Windows Vista Access 2007
    Join Date
    Aug 2011
    Posts
    21
    The problem is that their are so many skills over 120 for each employee so the replicating is taking ages in the report. Also as they are not stored in a table (Just a report) I can't interrogate them i.e. pull out all skills with less than say 30% at expert level.

  7. #7
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    In your report you are summing the data over all contract employees. If that's what you really want you can do this in a query with a little setup.

    Let me say first and foremost that your data structure is inviting problems in the long run. You should not be storing the person's name in each of your skills table, you should be storing their unique identifier (from your consultant name table). Let's say that you misspell someone's name when you originally enter them and give them a few tests, their name will be stored incorrectly and when you change to the correct spelling all those child records will be lost because there is no longer anyone matching that name in any of the skills tables records you added.

    Secondly all of your tables, *ALL* of them should have a unique identifier, some of your tables do not have one and any time you change a description or skill name or anything about a text value you are going to lose all your relationships. I think it's critical that you have a unique identifier in each table and when you need to reference information on a different table use use the foreign PK (for instance your skills lists tables)

    Third you are using reserved words for field names (NAME) and using spaces in your object names (field names, table names, form names, etc). This is going to cause a lot of problems as you move forward I would suggest biting the bullet now and anywhere you have a space put in an underscore _ and stay away from special characters (#,&, etc)

    Lastly, you're not using a normalized table structure which makes what you want to do a bit clumsy. I'm enclosing a copy of your database back to you if you look at the queries I built I had to normalize your data first through the union query then create a crosstab query for the data. It's a simple example of what you can do with your current structure.

  8. #8
    Filmnoir is offline Novice
    Windows Vista Access 2007
    Join Date
    Aug 2011
    Posts
    21
    Thanks Rpeare, points taken I'll work on these now.

    How exactly does this Union SQL work?

  9. #9
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    damned if I know how they work, they just do!

    I typically use them when I am tracking a specific person across different counties, each county having a different table but the same data fields. So in my union queries I pick the person I want an union all the fields so I can see their entire treatment history across counties.

    In your case, because your data is not normalized, the union query helps put it into a normalized structure so you can then perform your queries more efficiently.

    I know people do all kinds of crazy things with them to (which I haven't had occaison to experiment with) like adding subtotals to queries rather than doing it on a report

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

Similar Threads

  1. Replies: 0
    Last Post: 07-13-2011, 08:32 AM
  2. Functions
    By Alex Motilal in forum Programming
    Replies: 2
    Last Post: 09-27-2010, 08:06 AM
  3. Custom Functions
    By TheDeceived in forum Access
    Replies: 3
    Last Post: 09-16-2010, 02:12 PM
  4. sum functions
    By trippers in forum Queries
    Replies: 2
    Last Post: 08-04-2010, 07:09 PM
  5. Functions
    By jamin14 in forum Programming
    Replies: 1
    Last Post: 03-25-2010, 08:16 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