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

Primary Key Problem

123 100+
Hi,

My back end is access. I have 2 tables in it.
1) State Master
Fields: StateID Number (Primary key)
StateName

2) City Master
Fields: CityID Number (P.K.)
CityName
StateID Number (Foreign key)

I have following data in State Master
1 Gujarat
2 Maharashtra

Following data in City Master
1 Surat 1
2 Mumbai 2

Now i am changing the ID of StateId in State Master table from 2 to 3. So the record in City Master must be 2 Mumbai 3 instead of s Mumbai 2. I am not able to update. how it is done through front-end or back-end? My front is vb and back end is access.

ie.When I change the ID of the state ie StateID , I want to make change in CityMaster also. How to do that? Please tell me if u know.
Mar 22 '07 #1
4 1045
ansumansahu
149 100+
Hi,

My back end is access. I have 2 tables in it.
1) State Master
Fields: StateID Number (Primary key)
StateName

2) City Master
Fields: CityID Number (P.K.)
CityName
StateID Number (Foreign key)

I have following data in State Master
1 Gujarat
2 Maharashtra

Following data in City Master
1 Surat 1
2 Mumbai 2

Now i am changing the ID of StateId in State Master table from 2 to 3. So the record in City Master must be 2 Mumbai 3 instead of s Mumbai 2. I am not able to update. how it is done through front-end or back-end? My front is vb and back end is access.

ie.When I change the ID of the state ie StateID , I want to make change in CityMaster also. How to do that? Please tell me if u know.

If you want to do it from the backend you will have to first drop the relationship between the master table and the child table. Put the new values in and then re create the relationship between the tables.

thanks
ansuman sahu
Mar 22 '07 #2
Shailja
123 100+
If you want to do it from the backend you will have to first drop the relationship between the master table and the child table. Put the new values in and then re create the relationship between the tables.

thanks
ansuman sahu

How to do that in access? I dont know. Can u tell me?
Mar 22 '07 #3
vijaydiwakar
579 512MB
Hi,

My back end is access. I have 2 tables in it.
1) State Master
Fields: StateID Number (Primary key)
StateName

2) City Master
Fields: CityID Number (P.K.)
CityName
StateID Number (Foreign key)

I have following data in State Master
1 Gujarat
2 Maharashtra

Following data in City Master
1 Surat 1
2 Mumbai 2

Now i am changing the ID of StateId in State Master table from 2 to 3. So the record in City Master must be 2 Mumbai 3 instead of s Mumbai 2. I am not able to update. how it is done through front-end or back-end? My front is vb and back end is access.

ie.When I change the ID of the state ie StateID , I want to make change in CityMaster also. How to do that? Please tell me if u know.
See its a bad practise.
y ur changing the id?
So in future be aware of it.
For the time
goto Tools>Relationship
If u've made any relation ship then tbls will sbe shown if not then right click the window and add tables and create/break the relation ship and proceed
Good Luck
Mar 22 '07 #4
Dököll
2,364 Expert 2GB
These are great options, vijaydiwakar!

Another way of doing this would be to go right to VB and change data. Please forgive the lack of interest to use access. I work with it on the job, but I find it easier to control data through the front-end of things, than in access; especially that there is a VB Gui in the mix, I say go for it in that fashion. Nonetheless, I am leaning to agree with vijaydiwakar, you can easily update the data needed through access, I do it every six months. It's just not too friendly. If you are you are comfotable with access, perhaps you ought to give it a whirl.

I would also post in the Access Forum just to be covered, if I were you.

Please stay tuned :-)

Dököll
Mar 22 '07 #5

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

Similar topics

5
by: Ghulam Farid | last post by:
Hi i have a table with primary key defined on col1 and col2. now i want to have col3 also included in primary key. when i alter the table it gives me error for duplicate rows. there is an option...
1
by: dev | last post by:
Hej There. We have a big problem. We have now for 4th years had a SQL Server without problems. But sutnely some of the primary keys are deleted. The subdata to the primary keys are not deleted....
9
by: 101 | last post by:
Taking a course on SQL. They are saying you can get better performance by having multiple files for a group. They then graphically show an example of "Primary" with multiple data files. I have...
7
by: Ilan Sebba | last post by:
I am trying to add a record using SQL. My problem is that the primary keys are foreign keys, and these foreign keys are autonumbers. I therefore do not know the primary keys of the record I am...
7
by: Philip | last post by:
Hey all, (Access 2000) I've been having a horror story with this design problem. My Database is Structured like This: AUTHORS, BOOKS, PAGES. Those are the Tables and each Item in each table...
2
by: stranger | last post by:
My database is set up so people can input parts orders. Sometimes they order the same parts on a monthly basis. I want to be able to duplicate past parts orders and have it pasted in with a new...
1
by: | last post by:
Hi, I am getting the following error when I run my Visual Basic application: "Cannot add primary key constraint since primary key is already set for the table" I am using datasets with...
3
by: Hugh O | last post by:
Hi, I am not sure if this type of question should be raised in this Newsgroup. If not please direct me. I am new to using RDO.Net data access but I thought I understood it. The 6 lines of...
8
by: shumaker | last post by:
I'm wondering if adding an autonumber primary key will improve the performance of a multiuser access database on a network share. I have a website that lists many tips for improving performance of...
9
by: sonal | last post by:
Hi all, I hv started with python just recently... and have been assigned to make an utility which would be used for data validations... In short we take up various comma separated data files for...
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: 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
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
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
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...
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...

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.