Combining two table values into one field...

BrianExcel

Well-known Member
Joined
Apr 21, 2010
Messages
975
I have a textbox on an Access form.

The text box is supposed to contain both first and last name from the "Employees" table, but I can't figure out how to concatenate the fields in the text box.

If the table name is "Employees" and the two column names are "FirstName" and "LastName" how would I do this? I am trying to do it through the "Control Source" option within the "Properties" for the field...

Thanks!
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
Thanks Phil, but when I input that text it gives me a #Name? error in the field.

To be clear, the table is "Employees" (didn't include capitals last time) and the columns are titled "First Name" and "Last Name"

I made sure all capitals and spaces are correct, but I still get the same error...
 
Upvote 0
=trim(trim([employees].[first name]) & " " & trim([employees].[last name]))

Uppercase/lowercase won't make a difference in the expression. Apologies regarding the lack of the space in your name field. Perhaps a question I should have asked in the first place: is the form bound to the employees table or to another table?

Phil...
 
Upvote 0
Phil,

Sorry to be so bothersome...I am knowledgeable on Excel but still a beginner at Access. When I enter your text into the expression builder, the value in the field says "Unbound".

How do I change this to bound if I need to?
 
Upvote 0
1, the form needs to be bound to use what Phil has said.

2. the fields need to be part of the form's record source.

3. You don't need to use trim or the table name.

=[First Name] & " " & [Last Name]

However you can't have text boxes with the same name or else it will give you an error. So if you have a control on the form which has the same name as either of those fields, make sure to change it to like txtFirstName or txtLastName so they aren't the same.
 
Upvote 0
Thanks Bob. How do you do #'s 1 and 2 below? I am good with Office products but I need some remedial knowledge to begin with...
 
Upvote 0
You bind a table to the form by either selecting the table from the form's RECORD SOURCE property or by selecting a saved query or by creating your own query by clicking on the ellipsis(...) that appears next to the record source property when you put your mouse in it.

#2 should be handled by doing #1.
 
Upvote 0

Forum statistics

Threads
1,224,520
Messages
6,179,266
Members
452,902
Latest member
Knuddeluff

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top