concatenate from query

M

Mariah

Hello,

I created a query from a customer address table to pull out the people who
use aol. This query has the following fields: Name (this field compiles
their title, firstname and lastname into one field), MailAddress1,
MailAddress2, MailCity, MailState, MailZip. This query works very well and
does just what I need it to do.

I am trying to create a new query based off this one to concatenate the
people who live at the same address so they only receive one notice. The
concatenation is working for consolidating the addresses, but it is not
showing me any names in the concat column. I tried backtracking and just
using last names in the original query, but the concat column still didn't
show me any names.

This is what I have in the concatenation SQL:
SELECT qryAOLEmailusers.MailAddress1, qryAOLEmailusers.MailAddress2,
qryAOLEmailusers.MailCity, qryAOLEmailusers.MailState,
qryAOLEmailusers.MailZip, qryAOLEmailusers.Country, Concatenate("SELECT
[IndexName] FROM qryAOLEmailusers WHERE MailAddress1 & MailAddress2 &
MailCity & MailState & MailZip =""" & [MailAddress1] & [MailAddress2] &
[MailCity] & [MailState] & [MailZip] & """",", ") AS Concat
FROM qryAOLEmailusers
WHERE (((qryAOLEmailusers.CustomerType) In ("Sister","Associate")))
GROUP BY qryAOLEmailusers.MailAddress1, qryAOLEmailusers.MailAddress2,
qryAOLEmailusers.MailCity, qryAOLEmailusers.MailState,
qryAOLEmailusers.MailZip, qryAOLEmailusers.Country, Concatenate("SELECT
[IndexName] FROM qryAOLEmailusers WHERE MailAddress1 & MailAddress2 &
MailCity & MailState & MailZip =""" & [MailAddress1] & [MailAddress2] &
[MailCity] & [MailState] & [MailZip] & """",", ");

I appreciate any help anyone can give me. I don't know where to go from
here...
 
D

Duane Hookom

This looks ok to me. I would set a criteria in the query so that it returns
only a few records. Then set a break point in the code so you can step
through the lines of code to troubleshoot.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top