Solved

How create calculated field in a table for Initials?

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

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

Suggested Solutions

Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

696 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