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

2 columns with one Autonumber?

Is this (subject) a possiblity in access? I need to link the 'id'
field in two tables in my database together so the auto number provides
unique identifiers ACROSS the two columns. IE if the first 3 entrys in
table a are id 1, 2, and 3 the next entry in table b will be id 4

Jun 1 '06 #1
7 1646
You'd have to use normal number fields and write some VB to do this.

Granted that you COULD do it, it's such an odd request (IMO) that I have to
ask whether you might be better off to put all the data in one table
(assuming that the columns are the same) and add one column that indicates
what kind of row it is. In essence, the new column would indicate which
table you would have put it in IF you were using two tables. Then, you can
have queries that pull the rows out based on that column and, for all
practical purposes, be using two tables.

If the columns are not the same, then I have trouble making up a reason for
having unique ID coordinated across the tables.

Can you say more about what your data looks like and what you need to
accomplish?
Jun 1 '06 #2
I believe my method is correct in designing this. It exist like this:

My two tables hold instances of features for the website i am
designing. The reason for the seperate tables is we want to be able to
expand and add more instances later. (in that matter the vb may be the
best answer cause it will onday need to spread across more tables)
because they are all unique instances of features we want them to have
unique ids. However because they are very different features they need
different tables. I hope this all makes sense. I was kinda hoping
there was just a quick ability to like the autonumbers to make lookup
late easy.

Jun 1 '06 #3

Then the next question is will the occurance of the next record in the
first table with a 4 as the number cause a problem?

Jun 1 '06 #4

Yes it would need to be unique ACROSS the to tables only one id of 4
could exist in each table

Ron2006 wrote:
Then the next question is will the occurance of the next record in the
first table with a 4 as the number cause a problem?


Jun 1 '06 #5
WB****@gmail.com wrote:
I believe my method is correct in designing this. It exist like this:

My two tables hold instances of features for the website i am
designing. The reason for the seperate tables is we want to be able to
expand and add more instances later. (in that matter the vb may be the
best answer cause it will onday need to spread across more tables)
because they are all unique instances of features we want them to have
unique ids. However because they are very different features they need
different tables. I hope this all makes sense. I was kinda hoping
there was just a quick ability to like the autonumbers to make lookup
late easy.

Surely the answer is to have a 'master' table which just has two (or
possibly three) columns which are:-

Unique record number (which is what you require)
Pointer to table/record where the data is stored

The pointer could be made up of two columns (name of table and record
number) or a single variable from which you can work out where the data
is.

--
Chris Green

Jun 1 '06 #6
Still not sure I agree with the approach, but here is a way to do it:

Make yourself a table with an autonumber field. Put any other identifying
fields you come to feel will help after thinking this over.

Before adding data to any one of the (unlimited number of) features tables,
add a row to this Master Features table. Get the ID of the new row.

In your features tables, don't use AutoNumber. Use Long. Use the newly
retrieved ID as the primary key in whichever table you append the data to.
In fact, that suggests that one of the fields in the Master Features table
should be some indication of the table where you used the new ID value.
Otherwise, you'll have a hard time coming back later to do anything with
this master table. It's a standard master/detail relation, with the small
wrinkle of parsing out details across multiple tables. If you're not
fixated on using cross-table unique AutoNumber, which doesn't exist, this
approach should do the job.
Jun 1 '06 #7

I would look at two tables one to many relationship. You want to add
another instance for the same website? Doesn't seem to make since to
have two identical tables do this.

Jun 2 '06 #8

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

Similar topics

8
by: Arpan | last post by:
How do I find out how many columns exist in a SQL Server DB table before displaying the records of that table? Also how do I get all the column names as an array so that I can seperate each...
35
by: Traci | last post by:
If I have a table with an autonumber primary key and 100 records and I delete the last 50 records, the next record added would have a primary key of 101. Is there any way to have the primary key...
15
by: Paul T. Rong | last post by:
Hi everybody, This time a very very difficult case: I have a table "tblStudent", there are 50 students, I also made a form "frmStudent" based on "tblStudent", now if I don't want to show all...
26
by: jimfortune | last post by:
Sometimes I use Autonumber fields for ID fields. Furthermore, sometimes I use those same fields in orderdetail type tables. So it's important in that case that once an autonumber key value is...
11
by: Alan Mailer | last post by:
A project I'm working on is going to use VB6 as a front end. The back end is going to be pre-existing MS Access 2002 database tables which already have records in them *but do not have any...
5
by: explode | last post by:
I made a procedure Public Sub Novo(ByVal nova1 As String, ByVal nova2 As String) that creates a new oledbDataAdapter with insert update select and delete commads. I also added that commands can...
1
by: Gumbyu | last post by:
Hi. I am a newbie and am trying to build a form for a daily dietary menu. The problem I am having is that the form, which is based on a query to the primaryfood table does not update all the...
22
by: Rickster66 | last post by:
As Instructed this is a new thread regarding my original post: "Select Only 10 Columns Going Back" I'm sorry for the late response. I've been gathering up information and carefully with as much...
6
by: ashes | last post by:
Hi, I am creating an ecommerce website using Microsoft Visual Studio, VB.Net and MS Access 2003. I am new to VB.Net When someone wants to register on the website, they fill out a form and the...
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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
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...
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.