By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,097 Members | 1,351 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,097 IT Pros & Developers. It's quick & easy.

Primary Key Problem

100+
P: 123
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
Share this Question
Share on Google+
4 Replies


100+
P: 149
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

100+
P: 123
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
100+
P: 579
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
Expert 100+
P: 2,364
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

Post your reply

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