Text in middle of concatenated values

C

CW

On my shipping invoices, which are reports, I'm trying to display a line
that shows the following line: From Origin to Destination (Origin and
Destination being fields in the source query)
As the length of the Origin town varies I don't want to use fixed fields for
each value as this would either leave ugly gaps or the data would overwrite
each other.
So I have tried to concatenate everything in one textbox, with the word "to"
sandwiched in the middle. This is what I have tried:
=[Origin] & " " & to & " " & [Destination]
(I also tried it with extra quotes around "to" but then it printed it
exactly like that, showing the quotes).
Depending on what I do with the the position of the spaces and the
ampersands, I either get an incorrect syntax message or Access thinks that
the word to is a parameter and throws square brackets around it and asks me
for input when I run the report.
Where am I going wrong?
Many thanks
CW
 
B

BruceM

No need to treat the spaces differently than any other text. A space can be
included at the beginning or end of a text string just as it can be included
between words within a text string.

="From " & [Origin] & " to " & [Destination]
 
C

CW

That did it perfectly! Many thanks Dale!
CW

Dale Fye said:
Have you tried:

=[Origin] & " to " & [Destination]

HTH
Dale
--
Don''t forget to rate the post if it was helpful!

email address is invalid
Please reply to newsgroup only.



CW said:
On my shipping invoices, which are reports, I'm trying to display a line
that shows the following line: From Origin to Destination (Origin and
Destination being fields in the source query)
As the length of the Origin town varies I don't want to use fixed fields for
each value as this would either leave ugly gaps or the data would overwrite
each other.
So I have tried to concatenate everything in one textbox, with the word "to"
sandwiched in the middle. This is what I have tried:
=[Origin] & " " & to & " " & [Destination]
(I also tried it with extra quotes around "to" but then it printed it
exactly like that, showing the quotes).
Depending on what I do with the the position of the spaces and the
ampersands, I either get an incorrect syntax message or Access thinks that
the word to is a parameter and throws square brackets around it and asks me
for input when I run the report.
Where am I going wrong?
Many thanks
CW
 

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