[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 281
  • Last Modified:

Insert into table

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
Eddy2010
Asked:
Eddy2010
  • 2
  • 2
1 Solution
 
KCTSCommented:
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
 
KCTSCommented:
opps a + crept in...

me.UniqueID = me.First_Name & me.Last_name & me.DOB
0
 
Rey Obrero (Capricorn1)Commented:
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
 
mbizupCommented:
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
 
mbizupCommented:
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

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now