473,396 Members | 1,836 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.

how to use alter table and identity

Hi, I'm not familiar at access and at VBA either, so I need some help
or at least some hint please.
I have table "availabledrivers", coming from a query to the table
"drivers". Then I have a table "availablebus" coming from a query to
"bus".
Bus and Drivers have autonumber ID, so the tables I get have the IDs
screwed up..I mean..there are "holes" in them..it's like 1,2,5,7,11,20
etc
Now..I need to link the 2 resulting table...and I have to do it daily.
First record of "avalablebus" linked to first record of
"availablebus", second record of the first table, with second record
of the second one, etc etc until the last available bus. Now..to solve
this problem, I append the "availablebus" and availabledrivers" to
other 2 tables ("uppendBus" and "uppendDrivers"), created before,
having each an own autonumber ID. Then I link the fields with those
autnumber ID. Fine.
My problem shows up now. I have to delete all the records daily and re
run all the queries...but of course the autonumber IDs are going to go
on from the last number, instead of restarting from 1. So..I have to
make a module or something to reset it to 1, with step 1.
I'm supposed to use this code for both of them..for example

CurrentProject.Connection.Execute "ALTER TABLE uppendBus ALTER COLUMN
busID IDENTITY (1,1)"

and

CurrentProject.Connection.Execute "ALTER TABLE uppendDrivers ALTER
COLUMN driversID IDENTITY (1,1)"
My questions are:

what's the code of the whole routine? Should it be a private or public
one? Should I run this routine with a botton or a macro?...

I know what I have to do...but not HOW to do it ...
Thanks in advance

Gianfranco
Nov 12 '05 #1
0 6210

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

Similar topics

2
by: Heist | last post by:
Hi, I just want to know to turn this: CREATE TABLE . ( NOT NULL , (50) COLLATE French_CI_AS NULL , NOT NULL , (50) COLLATE French_CI_AS NOT NULL , NULL , NULL ) ON into this:
4
by: dayong | last post by:
i need to alter all foreign keys in my database and uncheck the "Enforce relationship for replication" check box. Using the EM, I extracted the code snippet below. unfortunately, when i run this...
2
by: me | last post by:
I would like to add an Identity to an existing column in a table using a stored procedure then add records to the table and then remove the identity after the records have been added or something...
7
by: pb648174 | last post by:
I am trying to add a column to a temp table and then immeditaely query against that new column. If I do this in Query Analyzer it works fine as long as there is a go in between, but I can't use a...
4
by: xixi | last post by:
hi, i have a table with create ddl using not logged initially, CREATE TABLE "NJIPD "."IVPWGMR" ("IVDY01" DECIMAL(2,0) , "IVMO01" DECIMAL(2,0) , "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS...
7
by: Serge Rielau | last post by:
Hi all, Following Ian's passionate postings on problems with ALTOBJ and the alter table wizard in the control center I'll try to explain how to use ALTOBJ with this thread. I'm not going to get...
1
by: Halfdood | last post by:
I am working on a data migration project using a pre-made SQL 2005 database. We need to migrate data to over 300 different talbes and the records number 20 million plus for some of the tables. We...
1
by: quincy451 | last post by:
Ok I have a table with fields as follows: field1 varchar(10) field2 varchar(10) field3 varchar(10)
7
by: quincy451 | last post by:
drop table . CREATE TABLE . ( NULL , (16) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , NULL , NULL , (16) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , (16) COLLATE
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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.