By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,851 Members | 1,183 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,851 IT Pros & Developers. It's quick & easy.

Searching for most common name

daoxx
P: 32
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.
Mar 11 '08 #1
Share this Question
Share on Google+
4 Replies


Expert Mod 2.5K+
P: 2,545
...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
Mar 11 '08 #2

daoxx
P: 32
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.
Mar 11 '08 #3

Expert Mod 2.5K+
P: 2,545
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
Expand|Select|Wrap|Line Numbers
  1. Select [name field], Count([name field]) As [How Many] from [your table]
  2. GROUP BY [name field]
  3. ORDER BY Count([name field];
  4.  
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
Mar 11 '08 #4

daoxx
P: 32
Thank you. (Needs at least 20 characters.)
Mar 11 '08 #5

Post your reply

Sign in to post your reply or Sign up for a free account.