Date Concatenation

G

Guest

On a report I have a date field for when the employee was hired. When I have
just the date in the control source box it displays fine. I would like to
concatenate this date with the word "Hired: " and have it show up in Long
Date format. Now I know I can use two text boxes, one with the hired word and
one with the date. But I think the concatenation makes it easier to format a
report, and I should be able to do this simple task. My last attempt, which
resulted in an #Error was this:

="Hired: " & format([Hire],"Long Date")

I must be missing something basic. Any help would be appreciated.
 
M

Marshall Barton

Michael said:
On a report I have a date field for when the employee was hired. When I have
just the date in the control source box it displays fine. I would like to
concatenate this date with the word "Hired: " and have it show up in Long
Date format. Now I know I can use two text boxes, one with the hired word and
one with the date. But I think the concatenation makes it easier to format a
report, and I should be able to do this simple task. My last attempt, which
resulted in an #Error was this:

="Hired: " & format([Hire],"Long Date")

I must be missing something basic. Any help would be appreciated.


The expression looks fine, but change the name of the text
box to something other than Hire.
 
G

Guest

A funny thing happened. I changed the box to HireTextBox and reran the
report. Got another error. I went to double check the formula and it said:

="Hired: " & format([HireTextBox],"Long Date")

The formula changed from the field in the query to the name of the box, and
with no notification, thank you. I deleted the words TextBox from the formula
and it worked. Thanks Marshall.

Now I am realizing I might be doing something wrong. When I enter a field in
the control source, I usually just copy and paste it up to the name. Is this
a problem? Should I be making sure all the boxes have names different from
the control source?

--
Michael Conroy
Stamford, CT


Marshall Barton said:
Michael said:
On a report I have a date field for when the employee was hired. When I have
just the date in the control source box it displays fine. I would like to
concatenate this date with the word "Hired: " and have it show up in Long
Date format. Now I know I can use two text boxes, one with the hired word and
one with the date. But I think the concatenation makes it easier to format a
report, and I should be able to do this simple task. My last attempt, which
resulted in an #Error was this:

="Hired: " & format([Hire],"Long Date")

I must be missing something basic. Any help would be appreciated.


The expression looks fine, but change the name of the text
box to something other than Hire.
 
M

Marshall Barton

Michael said:
A funny thing happened. I changed the box to HireTextBox and reran the
report. Got another error. I went to double check the formula and it said:

="Hired: " & format([HireTextBox],"Long Date")

The formula changed from the field in the query to the name of the box, and
with no notification, thank you. I deleted the words TextBox from the formula
and it worked. Thanks Marshall.

Now I am realizing I might be doing something wrong. When I enter a field in
the control source, I usually just copy and paste it up to the name. Is this
a problem? Should I be making sure all the boxes have names different from
the control source?


The only thing you did wrong was allow the Name Auto Correct
feature to mess up your edits. Turn that bleeping thing off
in Tools - Options - General before trying to get your
expression back to what it's supposed to be.
 

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