populate fields

rbsmit02

Board Regular
Joined
Jun 18, 2004
Messages
142
I have a table in my database that has a column for first and last name.

Anyone know how I go about this:
When a new record is added to the database i want the first inital of the first name and the whole last name to be printed to a column
in my table called picid.

ex.
Name - Ray Smith
PicID - rsmith

I think I will need to seperate the name column into first and last name columns to do this, but after that im not sure where to start.

Any help is appreciated. :biggrin:
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
The answer is don't, use a query instead.

The technique you want is called concatenation.
Create a query based on your table, substitute your fieldnames for FirstName & LastName and drop this line into the QBE Design mode.

PicID: Left(FirstName,1) & LastName

The reason is, queries can be used everywhere a table is used. There isn't any need to duplicate data in your table.

If you really have to do this though, an Update Query (use the above line without PicID:) to update a third field will work.

Mike
 
Upvote 0

Forum statistics

Threads
1,221,828
Messages
6,162,215
Members
451,752
Latest member
freddocp

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