A while ago i developed a little program that lets users remove items of stock from store.(access 2.0).
Years later we upgraded to access97 the code no longer worked?
Can anybody shed any light on this. I have entered the code below in full. I have since changed the code but it doesn't work as whell as this code did. any suggestion would be of great help as we have in the last few months upgraded to access 2000.
Private Sub Part_Number_AfterUpdate()
Dim D As Database, C As Control, R As Recordset
Set D = DBEngine.Workspaces(0).Databases(0)
Set C = Screen.ActiveControl
Set R = D.OpenRecordset(C.RowSource)
R.FindFirst "[Part Number]=" & C
[Part] = R![Part]
[Total] = R![Price]
[Total] = [Quantity] * [Total]
If [Quantity] > R![Quantity] Then
MsgBox "You cannot book out more than the actual amount in the store!", vbOKOnly, "McCarthy & Sons Ltd"
DoCmd.GoToControl "Quantity"
[Quantity] = 0
[Part Number] = Null
[Net] = 0
Else: MsgBox "Remove " & Quantity & " " & [Part] & " From Store?", vbOKCancel, "Remove Item"
If VbMsgBoxResult.vbCancel Then
DoCmd.GoToControl "Quantity"
[Quantity] = 0
[Part Number] = Null
[Net] = 0
If VbMsgBoxResult.vbOK Then
R.Edit
R!Quantity = R!Quantity - [Quantity]
R.Update
End If
End If
End If
End Sub
Years later we upgraded to access97 the code no longer worked?
Can anybody shed any light on this. I have entered the code below in full. I have since changed the code but it doesn't work as whell as this code did. any suggestion would be of great help as we have in the last few months upgraded to access 2000.
Private Sub Part_Number_AfterUpdate()
Dim D As Database, C As Control, R As Recordset
Set D = DBEngine.Workspaces(0).Databases(0)
Set C = Screen.ActiveControl
Set R = D.OpenRecordset(C.RowSource)
R.FindFirst "[Part Number]=" & C
[Part] = R![Part]
[Total] = R![Price]
[Total] = [Quantity] * [Total]
If [Quantity] > R![Quantity] Then
MsgBox "You cannot book out more than the actual amount in the store!", vbOKOnly, "McCarthy & Sons Ltd"
DoCmd.GoToControl "Quantity"
[Quantity] = 0
[Part Number] = Null
[Net] = 0
Else: MsgBox "Remove " & Quantity & " " & [Part] & " From Store?", vbOKCancel, "Remove Item"
If VbMsgBoxResult.vbCancel Then
DoCmd.GoToControl "Quantity"
[Quantity] = 0
[Part Number] = Null
[Net] = 0
If VbMsgBoxResult.vbOK Then
R.Edit
R!Quantity = R!Quantity - [Quantity]
R.Update
End If
End If
End If
End Sub