I have started developing an Access Database for my agency to utilize, starting with incident management. I have been attempting to develop a form that acts as a master index for all of our incidents, as well as a hub to open the investigation's associated form to be used by the investigator. I developed three regular tables and a junction table:
- Investigations - General Information
- Target(s)
- Victim(s)
- Target/Victim Joiner
The General Info Table has a one to many relationship to Targets, and Targets and Victims have a many to many relationship connected through the joiner table. This joiner table is also where the allegations and outcomes are so that each target and victim are have their own associated charge and outcome.
I ran two queries; one named Tar/VicQuery that features information gathered from the related tables above:
InternalIncidentID TargetID TargetFullName VictimID VictimFullName Offense(s) Outcome(s)
JAW-1 TAR-1 Smith Davie VIC-1 Harris Michelle Neglect Substantiated
JAW-1 TAR-1 Smith Davie VIC-2 Jones Mary Neglect Substantiated
JAW-2 TAR-2 Thimble John VIC-3 Man Joseph Abuse Substantiated
JAW-2 TAR-3 Rocket Sammy VIC-3 Man Joseph Abuse Substantiated
JAW-2 TAR-4 Berkowitz Josh VIC-3 Man Joseph Abuse Substantiated
JAW-3 TAR-5 McGowen Melissa VIC-4 Root James Theft Founded
JAW-3 TAR-5 McGowen Melissa VIC-5 Lopez Randy Theft Founded
JAW-3 TAR-5 McGowen Melissa VIC-6 Martino Bruno Theft Founded
JAW-3 TAR-6 Thimble John VIC-4 Root James Theft Unfounded
JAW-3 TAR-6 Thimble John VIC-5 Lopez Randy Theft Unfounded
JAW-3 TAR-6 Thimble John VIC-6 Martino Bruno Theft Founded
And another Query that runs off the above mentioned Query called TargetQuery:
InternalIncidentID TargetName
JAW-1 Smith Davie, Smith Davie
JAW-2 Thimble John, Rocket Sammy, Berkowitz Josh
JAW-3 McGowen Melissa, McGowen Melissa, McGowen Melissa, Thimble John, Thimble John, Thimble John
This above query uses Allen Browne's method of ConcatRelated to combine rows of data that have the same incident ID and concatenate the targets of the investigation. I have followed the instructions that Allen expresses on this page including creating the associated module, pasting in his function, and then attempting to utilize it as part of a query. I am also looking to do the same in another (or the same, if it's possible) query for victims attached to a case.
SQL Code for TargetQuery:
SELECT DISTINCT [Tar/Vic Query].InternalIncidentID, ConcatRelated("TargetFullName","[Tar/Vic Query]","InternalIncidentID= " & [Tar/Vic Query].[InternalIncidentID]) AS TargetName
FROM [Tar/Vic Query];
The results, as seen above, are very close to what I am hoping to achieve. The ideal would be that duplicate names do not appear again as part of the concatenate. How do I make this happen?
I attempted to use unique values to remedy this, which helped considerably in one way (reducing the number of records from 11 to 3), but did not solve the issue of "Davie Smith" appearing multiple times in the field for a case (in this case, he had two victims, as expressed in the first table). This is only part one of my conundrum unfortunately as I am fairly new to Access and SQL in general; I am hoping that, by the end of this, my form will look like this (with more fields prior to target and victim names but you get the idea):
InternalIncidentID TargetName VictimName
JAW-1 Smith Davie Harris Michelle, Jones Mary
JAW-2 Thimble John, Rocket Sammy, Berkowitz Josh Man Joseph
JAW-3 McGowen Melissa Thimble John Root James, Lopez Randy, Martino Bruno
Any help/education that can be provided on this would be much appreciated. I am well aware of the gap in my understanding of this program currently and am appreciative of all patience that is provided to me regarding this question. Below are the threads here on this website and elsewhere that I have reviewed prior to making this question: