Solved

Insert into table

Posted on 2013-10-31
5
261 Views
Last Modified: 2013-11-01
Cust_Tbl
Cust_frm

First_Name
Last_Name
DOB
Unique_ID

I would like to concatenate the first name, last name and DOB and insert the concatenation in Unique_ID field in Cust_tbl

what is the easiest way to do this if I am using a form to update the table.
0
Comment
Question by:Eddy2010
  • 2
  • 2
5 Comments
 
LVL 70

Expert Comment

by:KCTS
ID: 39615790
add the following to the AfterUpdate event on the First_name, Last_name and DOB text boxes on the form:

me.UniqueID = me.First_Name & me.Last_name+ & me.DOB
0
 
LVL 70

Accepted Solution

by:
KCTS earned 500 total points
ID: 39615792
opps a + crept in...

me.UniqueID = me.First_Name & me.Last_name & me.DOB
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 39615800
place this codes in your form module

Option Compare Database
Option Explicit




Private Sub First_Name_AfterUpdate()
UpdateUniqueID
End Sub
Private Sub Last_Name_AfterUpdate()
UpdateUniqueID
End Sub
Private Sub DOB_AfterUpdate()
UpdateUniqueID
End Sub


Sub UpdateUniqueID()
Me.Unique_ID = Me.First_Name & Me.Last_Name & Me.DOB
End Sub
0
 
LVL 61

Expert Comment

by:mbizup
ID: 39615827
In general you should use an auto number rather than personal info for a field like this.

The concatenated string can be derived at any time for display on forms or reports without needing to be stored as another field in your table.

Also, an autonumber is meaningless to the end user.  It can be used behind the scenes as a linking ID when creating relationships in your data, but you won't run across issues that more personal ID might cause when people get married, divorced or otherwise change meaningful personal data.
0
 
LVL 61

Expert Comment

by:mbizup
ID: 39616255
As a somewhat related aside, a continuing issue that Experts-Exchange has is that members cannot change their usernames, which is possible on other sites.  The reason for this is that the original developers used the username as a primary key rather than using a generic, meaningless ID such as an autonumber.  The fact that you can't change usernames is clearly worded in the membership agreement that everyone diligently reads when joining ...  :-) ..., but it still occasionally comes up as a problem when users decide that they really shouldn't have used their full name or other sensitive info  as their username.
0

Featured Post

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

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

Recently Microsoft released a brand new function called CONCAT. It's supposed to replace its predecessor CONCATENATE. But how does it work? And what's new? In this article, we take a closer look at all of this - we even included an exercise file for…
This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
The viewer will learn how to  create a slide that will launch other presentations in Microsoft PowerPoint. In the finished slide, each item launches a new PowerPoint presentation and when each is finished it automatically comes back to this slide: …

829 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