473,395 Members | 1,919 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

how to customize ID Number.

14
How do I customize an ID as primary key to be anything other than numbers. For example what if I wanted to create an ID based on the last three letters of a last name and the extension number.

Thanks
Sep 14 '08 #1
2 1629
missinglinq
3,532 Expert 2GB
For example what if I wanted to create an ID based on the last three letters of a last name and the extension number.
This is assuming that "extension" is a field in your table. In the code module of your form:

Expand|Select|Wrap|Line Numbers
  1. Private Sub Extension_AfterUpdate()
  2.  If Not IsNull(Me.LastName) Then Me.IDNumber = Right(Me.LastName, 3) & Me.Extention
  3. End Sub
  4.  
  5. Private Sub LastName_AfterUpdate()
  6.  If Not IsNull(Me.Extension) Then Me.IDNumber = Right(Me.LastName, 3) & Me.Extension
  7. End Sub 
This is kind of an unusual way to do this. Most schemes of this sort use the first three letters of a last name together with a number. Which would be
Expand|Select|Wrap|Line Numbers
  1. Private Sub Extension_AfterUpdate()
  2.  If Not IsNull(Me.LastName) Then Me.IDNumber = Left(Me.LastName, 3) & Me.Extention
  3. End Sub
  4.  
  5. Private Sub LastName_AfterUpdate()
  6.  If Not IsNull(Me.Extension) Then Me.IDNumber = Left(Me.LastName, 3) & Me.Extension
  7. End Sub 
Linq ;0)>
Sep 14 '08 #2
NeoPa
32,556 Expert Mod 16PB
The question isn't very clear, and Linq's answer could well be all you need. However, it is also possible to design a table where these elements are stored separately in two fields, but the Primary Key is made up of both fields. A Composite Index.

In Design mode simpy select all the required fields and click on the Primary Index button.

Even in this case, the AfterUpdate technique could be used if the partial name is required to be garnered from the contents of another field.
Sep 14 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

14
by: deko | last post by:
The below code dials a phone number when the subform datasheet cell containing the number is double clicked. The problem is that the dialer application (c:\windows\dialer.exe) pops up windows on...
1
by: Gianmaria | last post by:
Hi, i'm workin on a deployment project... i added two custom screen to make some tasks. 1) I need that user insert a serial number for my setup.. next i check the validity of this serial by a...
0
by: Maria | last post by:
Hi I am new to .NET and would like to know how do we customize the apprearance of a datagrid Precisely, I would like to make ONE row appear in BOLD, and I would like to specify the number of...
1
by: Amy Snyder | last post by:
I have a datagrid where I incorporate paging and sorting. My datagrid page mode is set to numeric. Is there a way for me to customize this to display something like this in the page header: ...
4
by: Fred | last post by:
Hello, datagrids have GridLines, BorderWidth, BorderColor, ItemStyle.CssClass, ShowFooter ... properties, which can be used to customize the way they look when printed, how does one achieve the...
1
by: JT | last post by:
Hi, We have 2 servers having the same web site running on port 8080. These two servers are load balanced and have DNS name, e.g. my.server.com. Now on both of these two servers, we put the same...
5
by: DLN | last post by:
Getting rid of the Customize option. I want to get rid of the {Right-Click}-{Customize} option on the tool bars. I’ve been able to get rid of all the other options but not Customize itself. ...
0
by: gkinu | last post by:
I have a Visual Studio 2005 Windows Application. I want to customize the setup. Specifically, I want the following. 1. If not already done, the database to be created and configured as necessary 2....
0
by: Sky | last post by:
I have an Access 2003 front-end database with custom toolbars. The toolbars work fine. One annoying feature is that at the far right edge of each custom toolbar there a small dropdown arrow....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.