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

Cascade Updating in forms and subforms

I created two table in access 2003.one is one side and other is many side.i designed a form based on primary table and inserted it one subform based on many side table.my problem is i enterd one new record in primary through main form and related data in subform.later i found the value of primary key wasnt true and now when i change the primary value related data in subform(many side table)is change but the value in primary dosnt change and error massage appears telling me search key in not found.as well as i coudnt establish cascade update in relationship menu and telling me you have data in many side but you ndont have correspond data in primary.icheck the table but i have all data is needed in primary
i would like help me.thanks a lot
Dec 26 '13 #1
7 3113
zmbd
5,501 Expert Mod 4TB
Bita2901:
Can you clarify this:
i found the value of primary key wasnt true
Do you mean that the the value you were using was not correctly recorded between the parent and child tables
OR
Do you mean that the the value you were using for a primary key was not the correct value to begin with?
Dec 26 '13 #2
NeoPa
32,556 Expert Mod 16PB
What do you have as a linking key?

How are the [Link Master Fields] & [Link Child Fields] set on your Sub-Form control?

PS. Please include in your next post the versions of Windows and Access that you're using.
Dec 26 '13 #3
@zmbd
the problem is:I have one table with a primary Key Contract_No,and a link table with foreign Keys,Contract_No,Event_Code,I Created a form bringing Primary table data and a subform in it For link Table.
I Activated referentional Integrity&Cascade delete,Update.I can add records to both table but when i want to delete records All records could be deleted except first record.when I want to delete first record the program displays a message saying "search key not found" as well as i cannot change the value of primary key from primarytable and have changed datain linked table.
Thanks for your help.Sicerely yours Majid
Dec 31 '13 #4
@NeoPa
Hi
I have tow table one main and one linked with same fieldname called Contract_No.in the sub form in property box of it is set child and parent links with the Field Contract_No
thanks for Your help.Sincerely yours Majid
Dec 31 '13 #5
@zmbd
Hi
I Created Tow Table one primary and one foreign with a same field link.the primary key is a field Contract_No
i inserted data in tow table.later i found that a Contract number for one record wasnt correct.noew when i want to change Contract number from primary table through form or direct in table it is not possible.cascade update and delete is active.when i want to delete all records in primary table all records could be deleted except the first recors saying this message : "The search key Not Found"
thanks for your help
sicerely yours Majid
Dec 31 '13 #6
zmbd
5,501 Expert Mod 4TB
Sounds like you really goofed the records; however, you're also going around in circles...

From what I get:

- This is a prime example why I never, ever, use any value with meaning for a primary key - Instead I usually use either an autonumber or a full date/time serial number.

- The cascase-update/delete only works from the Parent to the Child. If you are attempting to change the child's record in an attempt to change the parent this will not work and if by some unusual means you managed to get child record to change to something that was not in parent table (for example, deleting the relationship and then re-establishing - and I'd be surprised if it let you re-establish) then you've thrown all of your records off.

- Which record will not delete? The first record in the parent table or the child? If it's the parent, then there is a record in the child that has the refernce to the parent record; however, something was broken in the linkage. Back-up the database file and do a compact and repair.

>>Consider>>
Changing your database so that you are not using the contract id as the primary key. You can index-noduplicate the field that has the contract id to prevent duplicates at the table level.
Dec 31 '13 #7
NeoPa
32,556 Expert Mod 16PB
I would expect a field that is one of those included in the [Link Child Fields] property to be populated automatically by the sub-form.

Alternatively, if ever I'm working on a field that is not so linked, but which is common to both tables and is filtered anywhere on the form, I set the .DefaultValue property of the relevant control on the sub-form to match the item filtered. This approach may be worth a try.

Setting a .DefaultValue property correctly can be difficult, especially for string fields, but if done correctly always produces the desired results.
Dec 31 '13 #8

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

Similar topics

4
by: Mark Lees | last post by:
I've built a simple DB and I'm having my users test it at a different location running on a single workstation. Mean while I'm making changes to the forms and reports on my workstation. How do I...
0
by: DFS | last post by:
This works fine for me, and is very useful. You can't nest tab controls on each other, so: * start with main form * tab control 1 is placed on main form * subform 1 is placed on tab control 1...
8
by: Zlatko Matić | last post by:
Hello. How can I synchronize subforms content with current record in master form, if both form and subform are based on DAO code ? I assigned DAO recordset to forms by using QueryDef, on Load...
0
by: Chad | last post by:
Hello Everybody, I am trying to update a few textboxes automatically in vb.net. I have a timer updating the variables which are assigned to the textbox.text attribute, I would like to have the...
1
by: Nemisis | last post by:
Hi everyone, Wonder if anyone can shed some light on how i should setup cascade deletes of object data within my database. One option is to use SQL triggers, is this a good idea? Should the...
3
by: TonyJH226 | last post by:
I’m using Access 2003 and am a novice to Access. I am creating a form to facilitate data entry to seven tables. The main table (A) has four sub-tables that are related to the main table by...
1
by: tmh86 | last post by:
I am currently building a database within Access 2007. I have a form that is populated via vba coding and thereform is not stored in a specific table. I have created a button that essentially runs...
2
by: IqbalEva | last post by:
I have a form and a subform. After updating one of the cboBox in the main form I would like the cboBox in the subform to filter out only the products from the supplier selected above. Currently the...
4
by: iceboi714 | last post by:
Hey guys, I'm fairly new to Access so please be patient. Im currently using 2003 and my problem is...currently I have 2 Forms and each with a subform. FormB has a textboxB that gets a sum of...
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
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: 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
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?
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.