Concatenating First and Last names doesn't seem to work

foxxrunning

Member
Local time
Today, 15:42
Joined
Oct 6, 2019
Messages
109
Trying to create a report in which I concatenate a First Name and Last Name. Should be textbook simple. This is the code
=[Patients]![Firstname]+" "+[Patients]![LastName]
which I put in the Control Source field for the text box . Tried it with & and +.
What happens is when I change from design view to Report view, instead of seeing the Firstname and Lastname fields together, I get a msgbox asking me for First Name. Why does a msgbox pop up instead of the actual concatenated field???
 
Hi. One reason it might ask you is if you somehow accidentally misspelled the name of the field. If so, double-check the name of the control bound to the firstname field and try to use it. Hope that helps...
 
I used the expression builder and chose each field from within it. Didn't spell it out longhand at all.
 
That worked. Wow. Why? I thought it is necessary to reference the table + field to properly point the source where it needs to be. Guess not. Thanks alot for your help.
 
That worked. Wow. Why? I thought it is necessary to reference the table + field to properly point the source where it needs to be. Guess not. Thanks alot for your help.
That depends, but I guess not in your case. Glad to hear you got it to work. Good luck with your project.
 
I do not know for sure. If you are doing this in a form which has a table attached to it. Then the table name would be redundant.
 
That worked. Wow. Why? I thought it is necessary to reference the table + field to properly point the source where it needs to be. Guess not. Thanks alot for your help.

The reference is to a field in the recordset of the report. There are no table names there.

BTW When there are two fields with the same name from different tables in a query, the tablename gets included.
However it is important to realise the name of the field in these cases is not [tablename].[fieldname]
but [tablename.fieldname]
 
Thanks everyone. This is new information to me. I will remember the [tablename].[fieldname] vs [tablename.fieldname] info.
 

Users who are viewing this thread

Back
Top Bottom