Solved

How create calculated field in a table for Initials?

Posted on 2013-06-19
3
388 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 250 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 250 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

Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

687 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