Concatenate two fields into one

  • Thread starter Thread starter Yair Sageev
  • Start date Start date
Y

Yair Sageev

I have a Projects.City field and a Project.State field. I'm trying to
center them on a report but it is not possible to do without merging them
into one field. Alone, they work perfectly, but when I merge them it doesn't
work

I tried setting the control source to

Projects.City & "," & Projects.State

But when I pop up the report from a button in a form, it prompts me for the
project, and I get #name? in the merged field on the report.

I think this should be simple to do. Thanks for the help.
 
Try an equals sign (=) as the first character of the control source. This
should fix the problem. You'll also need a space after your comma to end up
with something like Boise, Idaho.

Regards,
David Straker
 
-----Original Message-----
I have a Projects.City field and a Project.State field. I'm trying to
center them on a report but it is not possible to do without merging them
into one field. Alone, they work perfectly, but when I merge them it doesn't
work

I tried setting the control source to

Projects.City & "," & Projects.State

But when I pop up the report from a button in a form, it prompts me for the
project, and I get #name? in the merged field on the report.

I think this should be simple to do. Thanks for the help.



.
You need to create a query with the Projects table.

Then, for the "Field" type in a name for the field such as:

Full AddCity:[City]&", "[State]

It will create the resulting field of "Full AddCity".
Note that you will need to attach the form or report to
this query, so anyother fields you need to be use on the
document also needs to be selected in the query.

It will then bring them together.
 
David,
What does the = do?
Thanks,
Ken

David Straker said:
Try an equals sign (=) as the first character of the control source. This
should fix the problem. You'll also need a space after your comma to end up
with something like Boise, Idaho.

Regards,
David Straker
 
It works one way. I've tried:

=[Projects].[City] & ", " & [Projects].[State]

When I click the PrintCoverPage Button, it prompts me to enter "Projects".

No matter what I type in, I still got #name.


What *did* work, and I don't think I should have to do this, is to make two
fields for Project.City and Project.State, name them ProjectCity and
ProjectState, and make them invisible,

Then I make a new filed called ProjectCityState whose control source is:

=[ProjectCity] & ", " & [ProjectState]

from the loaded report.

This works, but again, I don't think this is the right way.
 
Kenny,

Essentially it tells Access that the following characters are not a field
name, they are a formula that produces a string.

David Straker
 
Back
Top