Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

How create calculated field in a table for Initials?

Posted on 2013-06-19
3
Medium Priority
?
397 Views
Last Modified: 2013-06-20
I have a table and in the table I want to create a calculated field.  Also in the table is a "CompanyName" field.  If the user types "Anderson Smith & Johnson" I want the calculated field to display "AS&J".

Can this be done?  If so, what is the expression for the calculation?
0
Comment
Question by:SteveL13
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 28

Expert Comment

by:omgang
ID: 39260708
You really shouldn't be saving the calculated value to the table.  It's better to recalculate the value when needed in a query, form, report, etc.  In this way, if the name changes the calculated value will be changed as well.

As for the calculation itself......please hold.
OM Gang
0
 
LVL 1

Accepted Solution

by:
RCWade earned 1000 total points
ID: 39260726
I use the following function in Excel to get initials. It's no elegant, but it works. You should be able to fit it in your Access project easy enough.

Public Function Initials(strData As String)
Dim temp As Variant
Dim x As Variant
Dim newName As String
Dim newInitials As String

newInitials = ""
temp = Split(strData, " ")
For Each x In temp
    newInitials = newInitials & Left(x, 1)
Next

Initials = newInitials

End Function

Hope it helps.
0
 
LVL 28

Assisted Solution

by:omgang
omgang earned 1000 total points
ID: 39260745
To use the function provided by RCWade, in a query or ControlSource of a form/report control you could

Query column
Init:Initials([CompanyName])

Form/Report Control ControlSource
=Initials([CompanyName])

OM Gang
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

597 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question