First off, I have some working experience with using SQL queries in Java/C++, but I'm relatively new to the Access world, so please be gentle.
The database in question is for a large medical practice. For the purposes of this question, I have two tables: Clients and Visits. Each row in the Clients table is keyed by a unique clientID and has a genderID column (1 = male, 2 = female, 3 = transgender, 4 = unknown). Each row in the Visits table represents each visit by each client to the practice. It is keyed by a unique visitID and references Client's clientID as a foreign key. The Visits table also contains a date field (type Date/Time) that represents the date of the visit.
Now the question:
I want to generate a report that only shows Visit/Client data by year. For instance, I'd like to show the number of males that visited in 2005, the number of females that visited in 2005, etc. I can get a sum of all males in the Clients table easily, but I want to constrain the sum to only those males who have corresponding Visit records whose date falls in 2005.
I suppose I just need to know what to set the reports record source to in order to reference all of the fields from both tables, as well as what should be the control source of one of the tally fields, e.g. total number of males that visited in 2005).
Can anyone help?
Regards,
Jon Heese
The database in question is for a large medical practice. For the purposes of this question, I have two tables: Clients and Visits. Each row in the Clients table is keyed by a unique clientID and has a genderID column (1 = male, 2 = female, 3 = transgender, 4 = unknown). Each row in the Visits table represents each visit by each client to the practice. It is keyed by a unique visitID and references Client's clientID as a foreign key. The Visits table also contains a date field (type Date/Time) that represents the date of the visit.
Now the question:
I want to generate a report that only shows Visit/Client data by year. For instance, I'd like to show the number of males that visited in 2005, the number of females that visited in 2005, etc. I can get a sum of all males in the Clients table easily, but I want to constrain the sum to only those males who have corresponding Visit records whose date falls in 2005.
I suppose I just need to know what to set the reports record source to in order to reference all of the fields from both tables, as well as what should be the control source of one of the tally fields, e.g. total number of males that visited in 2005).
Can anyone help?
Regards,
Jon Heese