Concatenating First and Last names doesn't seem to work (1 Viewer)

foxxrunning

Member
Local time
Today, 13:55
Joined
Oct 6, 2019
Messages
93
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???
 

theDBguy

I’m here to help
Local time
Today, 13:55
Joined
Oct 29, 2018
Messages
10,713
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...
 

foxxrunning

Member
Local time
Today, 13:55
Joined
Oct 6, 2019
Messages
93
I used the expression builder and chose each field from within it. Didn't spell it out longhand at all.
 

foxxrunning

Member
Local time
Today, 13:55
Joined
Oct 6, 2019
Messages
93
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.
 

theDBguy

I’m here to help
Local time
Today, 13:55
Joined
Oct 29, 2018
Messages
10,713
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.
 

kevlray

Registered User.
Local time
Today, 13:55
Joined
Apr 5, 2010
Messages
819
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.
 

Galaxiom

Super Moderator
Staff member
Local time
Tomorrow, 06:55
Joined
Jan 20, 2009
Messages
11,981
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]
 

foxxrunning

Member
Local time
Today, 13:55
Joined
Oct 6, 2019
Messages
93
Thanks everyone. This is new information to me. I will remember the [tablename].[fieldname] vs [tablename.fieldname] info.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Top Bottom