Let me preface this by saying that i am not very experienced at all with Access. I have made only a couple of very basic databases, and am nowhere near experienced enough to take advantage of the program’s full potential. Also, i tried to find the answer to my question in Access Help, but i couldn’t find anything that fit the bill.
So, i have a small database, and some of the inputs involves people’s names. In each individual record, there is at least one person involved, and sometimes as many as four people. So, i have four columns:
Person 1
Person 2
Person 3
Person 4
arranged across the top of the table, and arranged sequentially in my input form.
If an individual record has only one person associated with it, that person’s name goes in the “Person 1” column. If it has two people, i use “Person 1” and “Person 2,” and so on, leaving the extra columns blank for that entry.
Also, when i’m inputting the names, i do it alphabetically for each entry. So, if the record contains John and Steve, it will look like this:
Person 1 Person 2 Person 3 Person 4
John Steve
but if the record contains Alice, Bruce, John, and Violet, it will look like this:
Person 1 Person 2 Person 3 Person 4
Alice Bruce John Violet
As you can see, most individuals, especially those whose names start with letters that come later in the alphabet, could end up in any one of the four columns, depending on whether they are alone in that entry, or whether they are with other people whose names come earlier in the alphabet. In the above example, John is “Person 1” in the first entry, but he is “Person 3” in the second entry.
My next step was to try to find all records in which John (for example) appears. This was relatively easy. I opened a query in design view, and in the criteria i put “John” under “Person 1,” and then, using the “or” function, put “John” as the criteria in the other three columns. This brought up all records where John was a factor.
Now this is where i need help. I could make a separate query for each individual, but there are a lot of them. What i want to know is whether it is possible to design a macro (something i’ve never done before) that would do this name search for whatever name i plugged in. Essentially, i want to be able to type “Steve” into a box, and have Access bring up all records containing the name Steve in one of the four “Person” columns.
For all i know, this might be extremely easy, and i’m just demonstrating my ignorance of Access. Or it might be completely impossible, and i’m just demonstrating my ignorance of Access. Either way, my ignorance is not in doubt.
Any assistance would be most welcome.
Disclaimer: All names have been changed to protect the innocent. Any resemblance to any person, living or dead, is purely coincidental.