Page 1 of 1

Combining data from multiple records into one record *Access

Posted: 04 Jun 2010, 12:58
by Tribble
Here is my problem.

I have a query that combines data from multiple fields into one field. I now need to combine all the generated fields from multiple records into one record in a query. I will then use that query in another query (yes - I know SQL is better for this but I have no idea how to do it in SQL)

EG:
Query Structure is as follows:
[Agent code] [CPDActivID] [Date of Advice] [Date of Int Serv] [Date of Serv Super] [Experience] [Process Flag]

The fields that I am interested in are [Agent code] and [Experience]
The query is called qryFSBExperience

Each agent would have one or more records listing the experience. I need to combine them in a query that would only contain [Agent code] and [Experience] to look something like this:

[Agent code] [Experience]
1.................1/2/02022002/01032004//
1.................1/12//01012000///
2.................1/2/01091999/03032001/21092003
2 .................1/7//03071995///
3................. ////


should become

[Agent code] [Experience]
1 .................1/2/02022002/01032004//;1/12//01012000///
2 .................1/2/01091999/03032001/21092003;1/7//03071995///
3 .................////

I know it has to be done in a Conc module (concatenate) but I am not getting it right.

Please help - my knowledge of VBA is dangerous.

Re: Combining data from multiple records into one record *Ac

Posted: 04 Jun 2010, 13:08
by doo_much
Get Ruad to do is in SQL - you're going to trip yourself up doing it in VBA.

Re: Combining data from multiple records into one record *Ac

Posted: 04 Jun 2010, 15:43
by Tribble
Mmmm - really? I have a friend who will work on the SQL solution but I need it sooner and not sure how long he is going to take. I googled it and there is very good help but only if you understand wth they are doing. And I don't.

Re: Combining data from multiple records into one record *Ac

Posted: 04 Jun 2010, 16:33
by doo_much
How many different agents do you have?

Re: Combining data from multiple records into one record *Ac

Posted: 04 Jun 2010, 16:37
by Tribble
About 600 if I remember correctly. Sorry - not at the office anymore so I don't have access to the SQL tables. But this report will only run twice a month - so it doesn't matter if it is sluggish.

Re: Combining data from multiple records into one record *Ac

Posted: 04 Jun 2010, 16:40
by doo_much
Tribble wrote:About 600 if I remember correctly. Sorry - not at the office anymore so I don't have access to the SQL tables. But this report will only run twice a month - so it doesn't matter if it is sluggish.
So you just want to concatenate every experience code seperated by a hyphen?
I'll give the loop a try.

Re: Combining data from multiple records into one record *Ac

Posted: 04 Jun 2010, 16:49
by Tribble
Semi colon if you don't mind :D Thank you so much. I really appreciate it.

Re: Combining data from multiple records into one record *Ac

Posted: 04 Jun 2010, 16:51
by doo_much
:oops:

Semi-colon it is.

I have to be off. I'll have a look when I'm back home. ;)

Re: Combining data from multiple records into one record *Ac

Posted: 04 Jun 2010, 16:56
by Tribble
Thanks - you do this - and you shall get an even bigger hug next time we meet :D Thanks

Re: Combining data from multiple records into one record *Ac

Posted: 05 Jun 2010, 08:59
by doo_much
doo_much wrote:Get Ruad to do is in SQL - you're going to trip yourself up doing it in VBA.
Well, I certainly tripped myself up trying this! :shock:

Anyway. Apparently - if you know what you're doing - this is quite easy.

Have a look at this.

Re: Combining data from multiple records into one record *Ac

Posted: 05 Jun 2010, 10:03
by Tribble
Thank you so much - that is more helpful than I have found to date. I shall read through and give it a try.

Thank you again - that is a big help. :D