Display Name data the other way round!

clare_voiant

Board Regular
Joined
Mar 20, 2002
Messages
76
Hi,

I have a database where the names in the Name field are displayed 'Surname Firstname'. Is there a way to display the field in the report as 'Firstname Sirname' using code?

thanks

Clare
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
Hi Clare,
Is there anything like a comma separating the surname and first name? Or is there just a space?
Andrew
 
Upvote 0
Hi Clare,

If you create a query, add the name field (or whatever you have called it) and in a new column in the "field" section enter this :

= Right ([name], Len([name]) - InStr([name]," ")) & " " & Left([name], InStr([name]," ") -1)

Remembering to use your variable name - I just used "name"

View the query and see if this is what you want. You can then use this query to either make a new table or to update the "name" field. Please beware that this query will give some odd looking results if there is more than one space.

HTH, Andrew. :)
 
Upvote 0
***I must read your post correctly***

You can use the logic I outlined above in the field on your report too - provided the field "name" (or whatever you have called it) is available in the underlying query or table.

A. :)
 
Upvote 0

Forum statistics

Threads
1,221,814
Messages
6,162,132
Members
451,743
Latest member
matt3388

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