Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
736 views
in Technique[技术] by (71.8m points)

ms access - How do I combine information from multiple rows (concatrelated) without getting duplicate values in my report?

I have created a database that has these tables:

  • Student list
  • Student booklet numbers
  • Student needs
  • Teacher Information

In the Student Needs Table I have information entered similar to this:

Student ID Column, Last Name, First Name, Reading Special Need

123456             Mouse      Mickey      Dictionary  
123456             Mouse      Mickey      Extra Time  
123456             Mouse      Mickey      Small group  
123456             Mouse      Mickey      Type Answer Choices  
654321             Duck       Daffy       Dictionary  
654321             Duck       Daffy       Thesaurus  
654321             Duck       Daffy       Small Group  

I need this to be pulled similar to this:

Student ID Column, Last Name, First Name, Reading Special Need  

123456             Mouse      Mickey      Dictionary, Extra time, Small group, type answer choices  
654321             Duck       Daffy       Dictionary, Thesaurus, Small Group

I used the concatrelated function in my report control source and it works to put all of the needs together, but because my query has the student listed multiple times, it is listing the student multiple times on the report. Like this:

Student ID Column, Last Name, First Name, Reading Special Need

123456             Mouse      Mickey      Dictionary, Extra time, Small group, type answer choices  
123456             Mouse      Mickey      Dictionary, Extra time, Small group, type answer choices  
123456             Mouse      Mickey      Dictionary, Extra time, Small group, type answer choices  
123456             Mouse      Mickey      Dictionary, Extra time, Small group, type answer choices  
654321             Duck       Daffy       Dictionary, Thesaurus, Small Group  
654321             Duck       Daffy       Dictionary, Thesaurus, Small Group  
654321             Duck       Daffy       Dictionary, Thesaurus, Small Group  

I have tried all that I can think of to fix this - to the point of exporting the report and deleting duplicates - but then the export cuts off at 255 characters- so that doesn't work. Surely I am missing something that would be relatively easy- but I can't figure it out!

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Use my DJoin function and a query like this:

SELECT 
    [Student Needs].[Student ID], 
    [Student Needs].[Last Name], 
    [Student Needs].[First Name], 
    DJoin("[Reading Special Need]","[Student Needs]","[Student ID] = " & [Student ID] & "",", ") AS [Reading Special Needs]
FROM 
    [Student Needs]
GROUP BY 
    [Student Needs].[Student ID], 
    [Student Needs].[Last Name], 
    [Student Needs].[First Name];

Output:

enter image description here


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...