Hello all of you helpers,
I have a problem trying to update a table from a list of parts in a sub form. I will try to explain:
I have a table of parts.
I have an assembly which contains some of the parts in this table which shows a quantity to be extracted from the parts table via a query.
I have created code to count through these items in the query which works on the form.
What I now need to do is enter code on each loop to look at the item description, find it in the parts table. Then find the stock level in the parts table and change the quantity according to the number in the assembly form - thus extracting the stock from the main stock records.
I hope you understand this I have tried to keep it as simple as possible.
Here is the loop code:
'Procedure to withdraw assembly items from the main stock levels
Private Sub CmdMoveStock_Click()
Dim ReadQuantityMove As Integer
Dim ReadStockLevel As Integer
Dim NewStockLevel As Integer
Dim MinStockLevel As Integer
Dim AssemblyPartNo As String
Dim AssemblyDescription As String
'Set up to count through records
Dim dbSpazio As DAO.Database
Dim rcdStockQty As DAO.Recordset
Set dbSpazio = CurrentDb
Set rcdStockQty = dbSpazi
penRecordset ("AssemblyExtractQRY")
'Loop
Do Until rcdStockQty.EOF
ReadQuantityMove = Val(Quantity)
ReadStockLevel = Val(StockLevel)
NewStockLevel = ReadStockLevel - ReadQuantityMove
StockLevel.Value = NewStockLevel
DoCmd.GoToRecord , , acNext 'Go to next record
rcdStockQty.MoveNext
Loop
End Sub
End Of Code
Can anybody make suggestions how I can do this?
Regards
Ricky
"To say 'thankyou' encourages others."
I have a problem trying to update a table from a list of parts in a sub form. I will try to explain:
I have a table of parts.
I have an assembly which contains some of the parts in this table which shows a quantity to be extracted from the parts table via a query.
I have created code to count through these items in the query which works on the form.
What I now need to do is enter code on each loop to look at the item description, find it in the parts table. Then find the stock level in the parts table and change the quantity according to the number in the assembly form - thus extracting the stock from the main stock records.
I hope you understand this I have tried to keep it as simple as possible.
Here is the loop code:
'Procedure to withdraw assembly items from the main stock levels
Private Sub CmdMoveStock_Click()
Dim ReadQuantityMove As Integer
Dim ReadStockLevel As Integer
Dim NewStockLevel As Integer
Dim MinStockLevel As Integer
Dim AssemblyPartNo As String
Dim AssemblyDescription As String
'Set up to count through records
Dim dbSpazio As DAO.Database
Dim rcdStockQty As DAO.Recordset
Set dbSpazio = CurrentDb
Set rcdStockQty = dbSpazi
'Loop
Do Until rcdStockQty.EOF
ReadQuantityMove = Val(Quantity)
ReadStockLevel = Val(StockLevel)
NewStockLevel = ReadStockLevel - ReadQuantityMove
StockLevel.Value = NewStockLevel
DoCmd.GoToRecord , , acNext 'Go to next record
rcdStockQty.MoveNext
Loop
End Sub
End Of Code
Can anybody make suggestions how I can do this?
Regards
Ricky
"To say 'thankyou' encourages others."