In my Access database, I’m trying to perform a search and find routine which is quite complicated. Basically, I have 4 criteria to look for in these four tables: Date, Service, Code and Function.
With this information I go into a table, and search in a field and for one criteria. After I’ve found the rows which correspond to one of the 4 criteria, I save the value of the neighboring field for all the rows which matched correctly. After this, I wanted to save the values of all the neighboring fields as an array. Then repeating these steps, I was going to save all 4 searches as 4 individual arrays.
The relationships of my tables are as follows:

I receive a “Demande” which is a request, and in that request are the four criteria: Date, Service, Code and Function.
In the table “Services_YES” I look for the Service that corresponds to the demand.
In the table “Pool_Personnel” I look for the Fonction that corresponds to the demand.
In the table “Days_Available” I look for both the Date and the Code (called Code_Horaire) which corresponds to the demand.
From there, I was hoping to record each Code_Personal for all of the results found, and then find which Code_Personal’s matched in all of the 3 tables.
So My question:
How I can do a search and find function which creates an array of for all of the Code’s which correspond to the criteria rows?
I have created psuedo code to help explain, and incase someone can translate this into real VBA:
While demandeTable.functionField.Value = poolpersonnelTable.Fonction1Field.Value
get all poolpersonnelTable.codepersonalField.Value for all rows that match
save fonctionArray = codepersonalField.Values
Loop
I’m very stuck on how to complete this ‘filtering’, and would strongly appreciate all help.
Using VBA is not the answer.
I ended up creating a Query, and using user-inputed text to fill in the variable parts of the query: