Update or copy?

Zelo

Registered User.
Local time
Today, 16:03
Joined
Mar 9, 2007
Messages
35
I have two tables. First table "Orders" is parent, secondary "Works" is child.
In Works on button event in field work_status i have the number, for example "6", which i must have in parent table "Orders" in field status_id. Criteria of this tables is order_id. What i must use? Update or copy? or Insert?
 
Not sure I understand your set up properly but I think you are saying that you have a record in Works, linked to a record in Orders, and that when you update a field in Works you want that same value to be given to a field in Orders. Is that right? I am also presuming you are working with forms?

In this case I would:
Use the AfterUpdate event of FieldInWorks to say Forms!frmOrders!FieldName = Forms!frmWorks!FieldName.

or

create an upend query and use the AfterUpdate event of FieldInWorks to update table Orders.

Dave
 
I'll try AfterUpdate method.


And I'l try to explain in details my problem. on first Step i'm working in Orders. Each order has a status_id ( 1 - "Set" 2 - "Answered" 3 - " " 4 - "Active".) When order "Active", i'm choosing active order in listbox, and on doubleclick on this order i'm opening form Works. Criteria on opening is order_id. Tables "Orders" and "Works" have the same field 'orders_id". Each order has a lot of works. Each work has status "work_status". And when all works are done, wrk_status must be number 5. When work_status 5, enabling button archiv. On this button click, i must set number 5 to the form Orders.status_id, and when status_id in Orders is 5, Order status must be "Done". So, i stack on this problem, when i can't set number 5, to form Orders in field status_id. I tried to make this action
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "Works"
stLinkCriteria = "[order_id]=" & Me![order_id]
DoCmd.OpenForm stDocName, , , stLinkCriteria
But it's working only, when this two Forms are open. So i need to set Works!work.status to Orders!status_id and close form Works
 

Users who are viewing this thread

Back
Top Bottom