Using / in data display

P

Pendragon

Trying to write a query where a field puts two names together and the names
are separated with " / " (with a space before and after the slash). Drawing
a total blank here. Data will always be in Name1, maybe in Name2.

MyField: qryIndividuals.Name1 & (" / " + qryIndividuals_1.Name2)

qryIndividuals and qryIndividuals_1 are LEFT JOINs from tblOfficialsList, if
that makes any difference.

If I use qryIndividuals.Name1 + " / ", I get all of the names with the
slash. But if I add in the qryIndividuals_1.Name2 to get the second names
where applicable, I get #Error.

How do I append the slash where there are two names?
 
K

KARL DEWEY

Try this --
MyField: qryIndividuals.Name1 & IIF(qryIndividuals_1.Name2 Is Null OR
qryIndividuals_1.Name2 = "", Null, " / " & qryIndividuals_1.Name2)
 
M

Marshall Barton

Pendragon said:
Trying to write a query where a field puts two names together and the names
are separated with " / " (with a space before and after the slash). Drawing
a total blank here. Data will always be in Name1, maybe in Name2.

MyField: qryIndividuals.Name1 & (" / " + qryIndividuals_1.Name2)

qryIndividuals and qryIndividuals_1 are LEFT JOINs from tblOfficialsList, if
that makes any difference.

If I use qryIndividuals.Name1 + " / ", I get all of the names with the
slash. But if I add in the qryIndividuals_1.Name2 to get the second names
where applicable, I get #Error.

How do I append the slash where there are two names?


That is exactly how you should do it. I suspect that there
is something funny about qry_1 and what it is doing with the
Name2 field (e.g. there is no Name2 field).
 

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