473,320 Members | 2,000 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,320 software developers and data experts.

A2K - how to create my own unique internal employee id

What's the current thinking about generating your own internal id for each
record in a table? In my case I would like to add a field, for internal use
within the program, that uniquely tags each employee record.

There was never any need to capture an employee number to try to distinguish
records, I just need to be able to find a record that refers to a specific
employee.

I was thinking of randomising a number and maybe adding some descriptive
characters, then checking to see if it existed before adding it to the
record.

Would that be on the right lines?

thanks
Martin
Jan 16 '06 #1
7 6252
Deano wrote:
What's the current thinking about generating your own internal id for
each record in a table? In my case I would like to add a field, for
internal use within the program, that uniquely tags each employee
record.

There was never any need to capture an employee number to try to
distinguish records, I just need to be able to find a record that
refers to a specific employee.

I was thinking of randomising a number and maybe adding some
descriptive characters, then checking to see if it existed before
adding it to the record.

Would that be on the right lines?

thanks
Martin


I should add that my records are distinguished by the autonumber primary key
but I now need this additional field.
Jan 16 '06 #2
Deano wrote:
What's the current thinking about generating your own internal id for
each record in a table? In my case I would like to add a field, for
internal use within the program, that uniquely tags each employee
record.

There was never any need to capture an employee number to try to
distinguish records, I just need to be able to find a record that
refers to a specific employee.

I was thinking of randomising a number and maybe adding some
descriptive characters, then checking to see if it existed before
adding it to the record.

Would that be on the right lines?

thanks
Martin

While I continue to talk to myself may I ask if I'm being clever here :)

I create a random number like so;
Dim varASTid As Variant
varASTid = Int((10000000 * Rnd) + 1)

Then I concatenate it with the existing PK and assign it to the new field
like so;
Me.txtASTid = Me.Teacher_ID & varASTid & "Emp"

Given the PK is unique do I now have a guaranteed unique id? I'm thinking
that I don't have to check the table now before I assign it....
Jan 16 '06 #3
What's wrong with an autonumber primary key? Typical name searches work on
last/first/MI, then show birth dates/SSN/phone/etc. to distinguish similar
people. My experience with these "manufactured" unique ID's (e.g.. last 4
SSN + first 4 LastName, etc.) is that they all break at some point. Phone
books and the SSA work just fine without them.
-Ed

"Deano" <de***@mailinator.com> wrote in message
news:43***********************@ptn-nntp-reader03.plus.net...
What's the current thinking about generating your own internal id for each
record in a table? In my case I would like to add a field, for internal
use
within the program, that uniquely tags each employee record.

There was never any need to capture an employee number to try to
distinguish
records, I just need to be able to find a record that refers to a specific
employee.

I was thinking of randomising a number and maybe adding some descriptive
characters, then checking to see if it existed before adding it to the
record.

Would that be on the right lines?

thanks
Martin

Jan 16 '06 #4

What is the point?

The only reason most people would consider this is to create a key which is
easy for humans to remmber or calculate. If it's simply a
database/application internal pk then just use the autonumber field you
already have.

What you are proposing just creates more work and more room for error with
no apparent gain.
--

Terry Kreft
"Deano" <de***@mailinator.com> wrote in message
news:43***********************@ptn-nntp-reader03.plus.net...
Deano wrote:
What's the current thinking about generating your own internal id for
each record in a table? In my case I would like to add a field, for
internal use within the program, that uniquely tags each employee
record.

There was never any need to capture an employee number to try to
distinguish records, I just need to be able to find a record that
refers to a specific employee.

I was thinking of randomising a number and maybe adding some
descriptive characters, then checking to see if it existed before
adding it to the record.

Would that be on the right lines?

thanks
Martin

While I continue to talk to myself may I ask if I'm being clever here :)

I create a random number like so;
Dim varASTid As Variant
varASTid = Int((10000000 * Rnd) + 1)

Then I concatenate it with the existing PK and assign it to the new field
like so;
Me.txtASTid = Me.Teacher_ID & varASTid & "Emp"

Given the PK is unique do I now have a guaranteed unique id? I'm thinking
that I don't have to check the table now before I assign it....

Jan 16 '06 #5
Ed Robichaud wrote:
What's wrong with an autonumber primary key? Typical name searches
work on last/first/MI, then show birth dates/SSN/phone/etc. to
distinguish similar people. My experience with these "manufactured"
unique ID's (e.g.. last 4 SSN + first 4 LastName, etc.) is that they
all break at some point. Phone books and the SSA work just fine
without them. -Ed


Well I'm going with my own idea and I WILL now check for duplicate entries,
fingers-crossed it won't break.
Jan 16 '06 #6
Terry Kreft wrote:
What is the point?

The only reason most people would consider this is to create a key
which is easy for humans to remmber or calculate. If it's simply a
database/application internal pk then just use the autonumber field
you already have.

What you are proposing just creates more work and more room for error
with no apparent gain.


The point is to help with an extension of the database which breaks so many
database design rules I dare not post their details here! Nevertheless it
is a simple and useful way of accomplishing what I need to do without
reinventing the whole database (which is what I should do).

It is required for internal referencing and not for human use though I have
a few words in mind for the humans who are asking me to do this...
Jan 16 '06 #7
Deano wrote:
The point is to help with an extension of the database which breaks so many
database design rules I dare not post their details here!


Just use another autonumber.
--
Tim http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "Whatcha doin?" - Ditto "TIM-MAY!!" - Me
Jan 16 '06 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Wolfgang Kreuzer | last post by:
Hello all, I have two tables - Projects and ProjectStruct Table Projects contains master records of the projects, ProjectStruct allows to define a project herarchie and contains the fields...
1
by: Mike | last post by:
I have a dataset that I need to validate. Here an example similar to what I need to do: <Company> <Employee> <Name>...</Name> <EmployeeID>1234</EmployeeID> </Employee> <Employee>...
0
by: Anas M. Nebuchadnezzar XXXVII | last post by:
I'm not sure if this is the right forum to ask this, seeing this problem is pretty much straight XSL, but here goes. I'm writting a simple employee database, and I want to be able to: A) get a...
6
by: skgolden | last post by:
My husband and I own a small temporary labor company and deal with 4 major clients (A,B,C & D), each of which has about 2 dozen units in our tristate area that we deal with (ie, Company A, units...
0
by: May | last post by:
Hello, We got this error (Internal connection fatal error) from our application and at the same we got "server application unavailable" error on the browser. I looked at the line that was...
4
by: ba.hons | last post by:
Hello all, Was wondering if anyone could provide some info on what could be a possible solution to a problem am having. I have to generate a Unique Identifier in C# which I will use to assign...
2
by: TGEAR | last post by:
I have a primary key (column name is emp_id) in employee table. Also, I would like to make a combination of other two columns is unique. (combination of officecode field and claimno field must be...
1
by: muld | last post by:
I've inherited a database system designed to calculate sickness absence statistics. There is a main table with an employee ID which also holds the number of days worked by that person in a year ....
2
by: lazyvlad | last post by:
Hi people, I thought I had a simple problem ahead of me but it turns out it ain't that simple as I hoped it would be. So here is the problem: I've got a table in a dataset which acts like a join...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.