Searching for most common name

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • daoxx
    New Member
    • Mar 2008
    • 32

    Searching for most common name

    Hi

    I'm using MS Access 2002 / VBA 6.
    I've a database with several tables / forms, and some code. Everything is working fine.

    I have 2 fields in each table. Each of these fields contain names from employees.

    What I need to find among all these 2 fields, is the most common name (the one that appears the most) in both fields together.
    Some of the fields may be empty.
    I need to perform this with a button, and I would also like that the search would be made in ALL of the database (all the tables), which means that by clicking the button only one name would come as output (msgbox maybe).

    Please help.
    Last edited by daoxx; Mar 11 '08, 10:08 AM. Reason: typo
  • Stewart Ross
    Recognized Expert Moderator Specialist
    • Feb 2008
    • 2545

    #2
    Originally posted by daoxx
    ...I've a database with several tables / forms, and some code. Everything is working fine.

    I have 2 fields in each table. Each of these fields contain names from employees.

    What I need to find among all these 2 fields, is the most common name (the one that appears the most) in both fields together.
    Some of the fields may be empty.
    ...
    Hi daoxx. I am sure the moderators wil advise you that posting multiple threads on the same topic is not an appropriate thing to do. Is this a student assignment that you are undertaking? If it is, you will see from the site rules that we cannot simply do the assignment for you, nor would it be fair to ask us to.

    You need to do some research for yourself on how best to process your records - it is up to you whether you use SQL or VBA to do so. With a bit of ingenuity you could use Count queries in SQL to give you counts of the number of separate forenames and surnames, and I am sure you will find you gain much more understanding of what you are doing if you find it out for yourself.

    -Stewart

    Comment

    • daoxx
      New Member
      • Mar 2008
      • 32

      #3
      Thanks for the fast response.
      I felt ignored on the other thread, and I'm sorry for double-posting the thread.

      This isn't "homework", it's for my part-time job. Please help me.
      Also, I do not seek experience with Access-related subjects.
      I need this done, and nothing more.

      Please help me.

      Comment

      • Stewart Ross
        Recognized Expert Moderator Specialist
        • Feb 2008
        • 2545

        #4
        Originally posted by daoxx
        Thanks for the fast response.
        I felt ignored on the other thread, and I'm sorry for double-posting the thread.

        This isn't "homework", it's for my part-time job. Please help me.
        Also, I do not seek experience with Access-related subjects.
        I need this done, and nothing more.

        Please help me.
        Hi daoxx. I have pointed you in one particular direction, and I would strongly suggest you develop Count queries for your tables. With limited Access experience, which from your reply you are not keen to develop, then going the VB route is simply not practicable. Use Access queries developed using the query designer or from SQL outlines such as the one below, tailored to meet your needs.

        The general form of the Count query is
        [code=sql]Select [name field], Count([name field]) As [How Many] from [your table]
        GROUP BY [name field]
        ORDER BY Count([name field];
        [/code]
        Regarding your 'all tables' requirement - depending on how many there are it may be simpler and much quicker that you devise similar count queries for all your tables, run them, then aggregate the results using Excel, say, which is excellent at such number crunching tasks.

        -Stewart

        Comment

        • daoxx
          New Member
          • Mar 2008
          • 32

          #5
          Thank you. (Needs at least 20 characters.)

          Comment

          Working...