Results 1 to 2 of 2
Thread: update quary access 2007
2015-12-10, 15:41 #1
- Join Date
- Dec 2015
- Thanked 0 Times in 0 Posts
update quary access 2007
i have mainform containing continuous subform i want to delete item number from the subform but before delete it i want to update the quantity in the textbox a record in the table, i used a updatequary in a quaries but an error shows to me error run time 3066, why these error appear note that i use like these quary before in another forms and it's work.
2015-12-10, 15:55 #2
- Join Date
- Mar 2004
- Manning, South Carolina
- Thanked 1,533 Times in 1,390 Posts
Let me see if I understand your question.
You have a Master Table we'll call MT which contains a Key Field we'll call MKey.
You have a linked table we'll call LT with item records which is linked to MT via a foreign key (MKey) value.
You have a field in the MT which is the total quantity of all the quantities in the LT with the same foreign key value as the MKey value of the item.
If the above is correct? You have a table design problem. It is very hard to maintain database data consistency in this situation. The MT should NOT contain a quantity field. You should calculate the quantity for the MT item when ever you need it thus insuring that you have the proper value and not missing values which may have been added or deleted from the LT and not properly updated in the MT.
Once your table structure is setup this way a simple requery of the master form after additions/deletions on the subform will automatically return the correct value.