Lnwolf3232
New Member
- Joined
- Aug 29, 2011
- Messages
- 2
I am writing code in Access that will allow me to update the Available Inventory for a product. This is all based on a table called tblOrders.
I have Initial Inventory, Used, Reorder, Received, and Available.
In the command button I have written the following code:
Private Sub cmdCalculate_Click()
Dim TempInitial As Double
Dim TempReorder As Double
Dim TempUsed As Double
Dim TempReceived As Double
Dim TempCurrent As Double
Dim TempAvailable As Double
Dim TempDiscontinued As Boolean
TempInitial = Initial_Inventory
TempReorder = ReOrder_Level
TempUsed = Used
TempReceived = Received
TempDiscontinued = Discontinued
If TempDiscontinued = False Then
TempCurrent = TempInitial - TempUsed
TempAvailable = TempCurrent + TempReceived
Available_Inventory = TempAvailable
Else
MsgBox ("Discontinued Cartridge Checked")
Available_Inventory = TempCurrent
End If
End Sub
When I initiate a quick watch all fields update appropriately, except not updating the Available_Inventory field on the form or in the table. Can someone please tell me what I am doing wrong..... It has been about 20 years since I have done Access, so I am very rusty.
I have Initial Inventory, Used, Reorder, Received, and Available.
In the command button I have written the following code:
Private Sub cmdCalculate_Click()
Dim TempInitial As Double
Dim TempReorder As Double
Dim TempUsed As Double
Dim TempReceived As Double
Dim TempCurrent As Double
Dim TempAvailable As Double
Dim TempDiscontinued As Boolean
TempInitial = Initial_Inventory
TempReorder = ReOrder_Level
TempUsed = Used
TempReceived = Received
TempDiscontinued = Discontinued
If TempDiscontinued = False Then
TempCurrent = TempInitial - TempUsed
TempAvailable = TempCurrent + TempReceived
Available_Inventory = TempAvailable
Else
MsgBox ("Discontinued Cartridge Checked")
Available_Inventory = TempCurrent
End If
End Sub
When I initiate a quick watch all fields update appropriately, except not updating the Available_Inventory field on the form or in the table. Can someone please tell me what I am doing wrong..... It has been about 20 years since I have done Access, so I am very rusty.
Last edited: