Access 2013 One record from many with same key

Anonymous
2014-04-30T19:33:12+00:00

So here is the problem: I have an excel file of

records. Among these records are some that belong to the same person,

different data. Because each person is identified with their own Id,

i.e, unique key, I am having an issue placing the data from two or more

records belonging to the same person in a single record for a data

summation.

I eventually, or simultaneously want to include the synthesized record with all other records for a count of data contained within all the records.

Of course, I have imported the records into an Access 2013 table for

manipulation, but I can't create a single record with multiple data from

the multiple records with identical keys.

If anyone has a solution or requires further clarification, I would appreciate help on the project.

Additional information; the table holds fields for all the data.

Microsoft 365 and Office | Access | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

54 answers

Sort by: Most helpful
  1. Anonymous
    2014-05-05T06:22:01+00:00

    Scott,

    I'm sure you understand it very well and then some; believe me when I say, I don't: there are nuances that you are overlooking. If you want to be helpful, help me sum without SQL or Setting anything unusual in the design Query, because I ran a sum and I didn't use any of those two option. I ran something between three files and came up with what I needed.

    The only difference here is that instead of drawing from the largest population, I'm drawing from a subset sitting in another file. Now I use the word file as you might use the word table.

    Understand, finding even the words to describe are reaching for me.

    Thank you in advance; I am also working to integrate the data into a letter. I presume I can use Microsoft Word, in template form, and I presume that it should be so user friendly, as to 123, and I'm done, if not, how far from easy is it?

    I can handle code if that's what it takes. I don't know how long it will take me, but if its code, then I need to know up front. As you know there are many dead ends when you are searching and developing in new territory, at least with this one, I haven't attempted it before. I made a new discovery, an equation of sort that reflects the indirect relationship between efficacy and unmet success over repeated trials.

    I hope not to repeat that phenomenon; it's draining to say the least, and after all, technology is suppose to be end-user friendly.

    Was this answer helpful?

    0 comments No comments
  2. ScottGem 68,840 Reputation points Volunteer Moderator
    2014-05-04T12:33:13+00:00

    I will mention, since Scott brought it up, I don't follow Group By... I think I've used it before, but I couldn't make it work.

    What's not to follow? A Group By query allows you to aggregate values across multiple records with the same value. This is why we kept telling you that you needed only ONE Visits table with a one to many relationship with your People table. With that structure a Group By query allows you to do those aggregates.

    As John said earlier, when in Query Design Mode, you press the Sigma icon on the Ribbon and it adds a Group By row to the grid area. In this row you can choose how to treat the value in that column. If you select Group By, then it will only show one row for that value. If you use multiple Group Bys, then if groups from left to right. So lets say you wanted a sum of visits, not only by patient but by Facility as well. So you put the Patien in the leftmost column as a Group By, Facility in the second column also as a Group by then add Visits in the third column, choosing a aggregate function. In your case, Sum, but you could also use Average or whatever is appropriate.

    This will give you what you want.

    You can also do this in a report. You can use the Report wizard to create the report and select to Group By Patient. Then you can select an aggregate on the Visits column to Sum the visits.

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2014-05-04T05:00:56+00:00

    Try

    SELECT MembershipPersonIDPerson.Person, MembershipPersonIDPerson.PersonID, Sum(Visit) AS NumberOfVisits

    FROM MembershipPersonIDPerson INNER JOIN AAMasterFile

    ON AAMasterFile.PersonID = MembershipPersonIDPerson.PersonID

    GROUP BY AAMasterFile.PersonID;

    What this will do will be to assemble all of the AAMasterFile records for each Person into a group (that's the GROUP BY), and within that group sum up (SUM) the values of all the Visit field values. It will then display the values of Person (the person's name I presume), the PersonID (not of much interest but maybe useful for debugging) and the sum of  Visit, using the alias name NumberOfVisits for the total.

    Was this answer helpful?

    0 comments No comments
  4. Anonymous
    2014-05-04T03:32:06+00:00

    I will mention, since Scott brought it up, I don't follow Group By... I think I've used it before, but I couldn't make it work.

    Was this answer helpful?

    0 comments No comments
  5. ScottGem 68,840 Reputation points Volunteer Moderator
    2014-05-04T02:33:53+00:00

    First, you should rename your tables. Change MembershipPersonIDPerson to tblPeople. No need to have such a long and redundant name. The other change to tblVisits. It is a more meaningful name.

    Then follow John's instructions to turn use that query to make a Group By query to get your totals.

    Was this answer helpful?

    0 comments No comments