473,379 Members | 1,185 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,379 software developers and data experts.

Trying to change data type from number into Autonumber

I am working on making a database for schoolwork and i was asked in corrections to change the data type from number to autonumber because when i go into design view and try to enter my records (for a dental practice eg. client details)
it would automatically enter the next number for the Appointment ID (1,2,3,4 etc.) but when i try this for each of my foreign keys in the table (client ID, employee ID, payment ID and Treatment ID) a notification comes up saying "you cannot change the data type or field size of this field; it is part of one or more relationships" it says i must delete the relationships to do this? i tried this already in "database tools" section but i haven't got a clue! can someone help please!? i am using Microsoft Access 2007 Thanks

Cal :)
Oct 4 '16 #1
1 1448
PhilOfWalton
1,430 Expert 1GB
Basically, you can't.

Roughly speaking having back up your database -just in case....
you need to create an Autonumber field in every table where there isn't one, and set that as the primary key. Then create a new field in the main table - Type numeric - long for all the related tables.

So I'm presuming Appointments is your main table and Clients, Employees, Payments & Treatments are your are your related tables.

So those 4 tables will have a new Autonumber prime key called
NewClientID, NewEmployeeID, NewPaymentID & NewTreatmentID.

The Appointments Table will have a new Autonumber prime key called NewAppointmentID.

Open each table and the New Automumber fields will automatically be populated.

Now create 4 update queries with Appointnents and 1 of the other 4 tables.

So assuming that your first update query is with Appointments & Clients.

You say you already have a relationship established between the old ClientID from the Client table and the old ClientID in the Appointments table. So you need to update the NewClientID in the Appointments table to the NewClientID from the Clients table.

Do that for all 4 update queries.
Delete the existing relationships
Add the new relationships between the New... in each of the tables.
CHECK VERY CAREFULLY that all is OK.
Delete the redudand old fields in all 5 tables

Good luck

Phil
Oct 5 '16 #2

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

Similar topics

3
by: rdraider | last post by:
I'm doing a data conversion project, moving data from one SQL app to another. I'm using INSERT INTO with Select and have the syntax correct. But when executing the script I get: Server: Msg...
1
by: Nothing | last post by:
I received a db2 data file that I converted to MS-Access. From Access I ran the upsize wizard to put the tabel in SQL. It put the table in ok but all the data types are nvarchar. I have a couple of...
0
by: Jacques | last post by:
Hi I'm using the ODBC driver DB2 Connect v 7.01.00.41. on Windows2000 to read from Hummingbird Genio on a IBM DB2 Database. I remark some errors on data type Number(X, Z). The operation result is...
2
by: deko | last post by:
I have an unbound text box on a form that is set to: Format = Short Date (with the corresponding input mask) When I run this: DoCmd.RunSQL ("UPDATE tblOutput SET ApptStart = " &...
1
by: Ravi | last post by:
HI all, we r using db2 V 8.2, when i am trying to change data type ie. SMALLINT to INTEGER(no data in the table), iam getting this error messege. Pl. help me slove the error. ERROR is ...
5
by: dananrg | last post by:
I was messing around with the native ODBC module (I am using Python in a Win32 environment), e.g: import dbi, odbc ....and it seems to meet my needs. I'd rather use a module that comes...
3
by: hpaisawala | last post by:
Hiya, Is it possible to create a command button on a form and code it such that it goes to a particular field and changes the data type property of that filed from Auto Number to Number. Many...
1
by: rdawadiuk | last post by:
hello professnols, In my table I have, among other, two fileds "Activity" and "Accont ID". I use form to fill the data in the table. If the field "activity " is either "deposit" or withdraw"...
8
by: mlwerth | last post by:
Dear Access Group: This is the most basic and most embarrassing of questions, but I cannot find where to change the data type of a text field that I have in Access 2003 to a number field. I've...
6
by: Annabelle Lee | last post by:
HeyHey, I'v got stucked on this problems for days already. What I am trying to do is to change the data type of a sepcific colume within a table which I am importing to my Access database. My...
1
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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: 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...

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.