mike60smart
Registered User.
- Local time
- Today, 04:00
- Joined
- Aug 6, 2017
- Messages
- 1,988
Hi Everyone
I have a Popup Continuous form named "frm91NotPurchased"
On the Form there is an Unbound Control named "txtAllocated" which uses the following as its Control Source:-
=Nz([ReqQty],0)+Nz([Allocation],0)
I then have an On Click Event where I am trying to update the Control named "Allocation" in a table named "Stocklist" for
each of the records shown on the Form.
When running the following Code I get the following error:-
The Code is as follows and when run it highlights frm91NotPurchased in Line 20 .
Any help appreciated
I have a Popup Continuous form named "frm91NotPurchased"
On the Form there is an Unbound Control named "txtAllocated" which uses the following as its Control Source:-
=Nz([ReqQty],0)+Nz([Allocation],0)
I then have an On Click Event where I am trying to update the Control named "Allocation" in a table named "Stocklist" for
each of the records shown on the Form.
When running the following Code I get the following error:-
The Code is as follows and when run it highlights frm91NotPurchased in Line 20 .
Any help appreciated
Code:
Private Sub cmdUpdate_Click()
10 On Error GoTo cmdUpdate_Click_Error
Dim rs As Object
20 Set rs = Me.frm91NotPurchased.Form.RecordsetClone
30 With rs
40 Do While Not .EOF
'Do Something
50 CurrentDb.Execute "UPDATE StockList SET Allocation = Me.txtAllocation" _
& " WHERE StockNumber = '" & Me!StockNumber & "'", dbFailOnError
60 .MoveNext
70 Loop
80 End With
90 Set rs = Nothing
100 MsgBox "All Stocklist Items Updated", vbInformation
110 DoCmd.Close ""
120 On Error GoTo 0
130 Exit Sub
cmdUpdate_Click_Error:
140 MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure cmdUpdate_Click, line " & Erl & "."
End Sub