473,830 Members | 2,034 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Create a Sequencing PK without using AutoNumber field

I have a table that is imported from another system. I have no choice
but to use the data as is; they will not change it. The records are
not unique.

For reasons I don't want to get into, I can't use an AutoNumber field.
Also, there is no combination of fields that will provide a unique key.

So, I could assign a number in my import code. My thought would be to
just select the highest number currently existing in the table and
increment it by 1. This should work but if anyone knows of any
unintended consequences, I'd appreciate a heads up.

Thanks.

Dec 27 '06 #1
3 2032

rdemyan wrote:
I have a table that is imported from another system. I have no choice
but to use the data as is; they will not change it. The records are
not unique.

For reasons I don't want to get into, I can't use an AutoNumber field.
Also, there is no combination of fields that will provide a unique key.

So, I could assign a number in my import code. My thought would be to
just select the highest number currently existing in the table and
increment it by 1. This should work but if anyone knows of any
unintended consequences, I'd appreciate a heads up.
I've had timing issues when I've used this approach with multiple users
running import routines.

if you're importing via vba on a record by record basis I'd just
implement a counter.
Another key I sometimes use is a time stamp with microseconds and/or a
counter stored as a string.

Cheers

Keith

Dec 27 '06 #2
On 27 Dec 2006 08:25:41 -0800, "rdemyan" <rd*****@hotmai l.comwrote:

Unsure what problem you're trying to tackle.
You say you must use the data as is, then you say you could assign a
number in your import code. That reeks of your ability to add to the
data - perhaps an additional column.
What import code are you speaking of? DoCmd.TransferD atabase? We may
need to see some code.
Once the table is in Access, why not alter the table and add a PK?
Why require a PK? For pseudo-uniqueness? You already said the data has
duplicate rows. I would start there. What's the significance of having
two rows with the exact same values in all fields? It may be bogus and
could be filtered out, or perhaps it is significant. We may need to
know more about the data.
Once you have this unitue number, what would you do next?

Perhaps you could address these questions. It would narrow down the
next set of them.

-Tom.
>I have a table that is imported from another system. I have no choice
but to use the data as is; they will not change it. The records are
not unique.

For reasons I don't want to get into, I can't use an AutoNumber field.
Also, there is no combination of fields that will provide a unique key.

So, I could assign a number in my import code. My thought would be to
just select the highest number currently existing in the table and
increment it by 1. This should work but if anyone knows of any
unintended consequences, I'd appreciate a heads up.

Thanks.
Dec 28 '06 #3
The data is imported from a spreadsheet using a custom procedure. With
the way things are currently done, you can legitimately have duplicate
rows.

I just want to add a field so that I can for the purposes of my
database be able to find a unique row. For example, if the duplicate
rows are shown in a listbox along with other non-duplicate rows and a
user wants to delete one of the duplicate rows from the table, how
would he do it without a PK. Without a PK wouldn't the delete
operation delete all duplicate rows. Plus I would have to specify a
compound key of all fields in order to even just get the duplicates of
that specific instance.

Besides, I thought it was good practice to have PKs. Upsizing to SQL
Server requires that each table have a PK doesn't it.
Tom van Stiphout wrote:
On 27 Dec 2006 08:25:41 -0800, "rdemyan" <rd*****@hotmai l.comwrote:

Unsure what problem you're trying to tackle.
You say you must use the data as is, then you say you could assign a
number in your import code. That reeks of your ability to add to the
data - perhaps an additional column.
What import code are you speaking of? DoCmd.TransferD atabase? We may
need to see some code.
Once the table is in Access, why not alter the table and add a PK?
Why require a PK? For pseudo-uniqueness? You already said the data has
duplicate rows. I would start there. What's the significance of having
two rows with the exact same values in all fields? It may be bogus and
could be filtered out, or perhaps it is significant. We may need to
know more about the data.
Once you have this unitue number, what would you do next?

Perhaps you could address these questions. It would narrow down the
next set of them.

-Tom.
I have a table that is imported from another system. I have no choice
but to use the data as is; they will not change it. The records are
not unique.

For reasons I don't want to get into, I can't use an AutoNumber field.
Also, there is no combination of fields that will provide a unique key.

So, I could assign a number in my import code. My thought would be to
just select the highest number currently existing in the table and
increment it by 1. This should work but if anyone knows of any
unintended consequences, I'd appreciate a heads up.

Thanks.
Jan 2 '07 #4

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

Similar topics

1
3365
by: poohnie08 | last post by:
i have a excel spreadsheet showing staff name, date,work hour, ot hour, slot1, slot2, slot3, slot4 and others). The "()" will keep repeating from day 1 until end of month. eg in excel spreadsheet, ============================================================================== A1 |A2 A3 A4 A5 A6 A7 A8 |A9 A10 A11 | 01/02/04 |02/02/04 StaffName |Work Hr OT Hr Slot1...
3
51272
by: Gekko . via AccessMonster.com | last post by:
I want to create a query that the first field should be an autonumber. For example I want the name and last name from the Emp table, but I want that the first field is an autonumber that identifies the record so the results of the query should look something like Field1 Name LastName 1 Gekko NoLast 2 Mary Jane 3 Jon Doe ***************************************** * This message was posted via...
4
7752
by: Apple | last post by:
1. I want to create an autonumber, my requirement is : 2005/0001 (Year/autonumber), which year & autonumber no. both can auto run. 2. I had create a query by making relation to a table & query, but I can't update record in query or in form. I believe the problem is due to the source query. In source query, there is a filter to show the incomplete record ("is null" in delivery date)], but I need to re-use the job no. if the job is...
4
6764
by: adolph | last post by:
I created 2 tables, each with an autonumber primary key. Fields are: ID (autonumber Primary key) Number (single) Color (Text) FName (text)in one table and LName (text)in the other What I'm trying to do is make a select query with not one but two fields in the join, that will allow me to update the LName field . IE SELECT FirstName.FName, LastName.LName, FirstName.ID, FirstName.Number,
0
1221
by: Tom Houston via .NET 247 | last post by:
I have built vb.net application that runs on my SBS2003 thatconsists of 20 plus form and menus. I am having problems with aweb form using textboxes. There are also three buttons,back/exit/save. The client has requested that the user be ableto use the enter key to progress from field to field. I haveset up the tab sequencing and the tab key works. I tried ascript to set the focus to the next field in each textbox'smethod, but when an enter is...
9
60105
by: minjie | last post by:
I need to upgrade a MS Access database (Version 2002) with a script only, i.e., via SQL statement, not via Access GUI, and I'm having trouble defining an AutoNumber field. I got an exception error when running the follwoing (in a C++ program using ADO): ...... cmdStr = "CREATE TABLE mytab " "( AutoNumber, " " TEXT(50), " "CONSTRAINT PRIMARY KEY ()); ";
2
1957
by: micksitup | last post by:
Without using autonumber, how can i generate the next available record number to appear in the primary key field on a data entry form? For example, i want to add a new supplier, but the primary key "supplier_id" is just set to number. I dont want to use autonumber. When i goto this form i wish it to look at the last record number, add 1 to it, then prepopulate the id field
2
1724
by: krmcdonald | last post by:
I realize this has been covered a billion times, I've read them all and still can't get it. My table looks like this: DOCUMENT-SER.NO MC006343 -SST-24569 MC006344 -SST-27209 MC006344 -SST-27210 MC006397 -SST-25019 MC006397 -SST-24562 MC006397 -SST-24562 MC006397 -SST-99173 MC006397 -SST-99173
1
2793
by: sanju4kk | last post by:
I am attempting to create a module that I can call to create a new field in my temp table that will be an autonumber, and then assigned that new field as the primary key. I have been search high and low for the code, it seems like an easy task but haven't solved the problem yet. Here is the current scenario: I import an text file of numbers, once imported, I need to assign a unique (autonumber) value to each number imported, starting with 1...
0
9642
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10524
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10199
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9312
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7741
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5616
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5779
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4409
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3074
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.