veracity777
New member
- Local time
- Today, 22:06
- Joined
- Jul 10, 2003
- Messages
- 8
Hi All,
I need to create a new record/row in a Header table, create one or more orresponding rows in the child table and then return to the header row and save some extra data.
I need to save the header row first to obtain the TransID which is an auto-increment field. This is used in all subsequent matching child records. Once all the child records are saved (these may vary from one to 100s per header row), I need to save a Total value back into the header row.
When I attempt to run this code, Access displays and error and advises that "The row cannot be located for updating. Some values may have changed since it was last saved."
Here is my code...
If curTotal = 0 Then
myTransRS.AddNew
myTransRS!TransDate = Now
myTransRS!EmpID = cEmpID
myTransRS.Update
cTransID = myTransRS!TransID
End If
If cSize <> "none" Then
curItemCost = CalcItemCost(curbutton.Name, cSize)
curTotal = curTotal + curItemCost
nLastItemCost.Value = curItemCost
nTotal.Value = curTotal
Else
CalcNonPLU
End If
myTransRS.MoveFirst
myTransRS.Find "[TransID]='" & cTransID & "'"
myTransRS!TransTotal = curTotal
myTransRS.Update
myTransItemRS.AddNew
myTransItemRS!TransID = 66
myTransItemRS!PLUID = myKeyLabelRS!PLUID
myTransItemRS!PLUAMOUNT = curItemCost
myTransItemRS!PLUDescrip = myKeyLabelRS!KeyLabel
myTransItemRS!PLUGroup = myKeyLabelRS!PLUGroup
myTransItemRS.Update
It's probably something simple (I am new to Access), but any help appreciated.
cheers
I need to create a new record/row in a Header table, create one or more orresponding rows in the child table and then return to the header row and save some extra data.
I need to save the header row first to obtain the TransID which is an auto-increment field. This is used in all subsequent matching child records. Once all the child records are saved (these may vary from one to 100s per header row), I need to save a Total value back into the header row.
When I attempt to run this code, Access displays and error and advises that "The row cannot be located for updating. Some values may have changed since it was last saved."
Here is my code...
If curTotal = 0 Then
myTransRS.AddNew
myTransRS!TransDate = Now
myTransRS!EmpID = cEmpID
myTransRS.Update
cTransID = myTransRS!TransID
End If
If cSize <> "none" Then
curItemCost = CalcItemCost(curbutton.Name, cSize)
curTotal = curTotal + curItemCost
nLastItemCost.Value = curItemCost
nTotal.Value = curTotal
Else
CalcNonPLU
End If
myTransRS.MoveFirst
myTransRS.Find "[TransID]='" & cTransID & "'"
myTransRS!TransTotal = curTotal
myTransRS.Update
myTransItemRS.AddNew
myTransItemRS!TransID = 66
myTransItemRS!PLUID = myKeyLabelRS!PLUID
myTransItemRS!PLUAMOUNT = curItemCost
myTransItemRS!PLUDescrip = myKeyLabelRS!KeyLabel
myTransItemRS!PLUGroup = myKeyLabelRS!PLUGroup
myTransItemRS.Update
It's probably something simple (I am new to Access), but any help appreciated.
cheers