Z
zhenchyld
i'm working on teaching my .mdb to adjust an inventory value based on a
quantity that is shipped to a customer. i've set up a tiny practice DB to
work out how to do this before i try to implement it in the real version.
i've checked the value of my variables and i can calculate the value that the
inventory needs to be set to after the ship quantity is subtracted, but i
cannot for the life of me figure out how to insert that new value
(intNewOnhand) back into my table.
here's the code so far:
Public Sub ADJUST_BUTTON_Click()
Dim intOnhand As Integer
Dim intShipQuantity As Integer
Dim intNewOnhand As Integer
intShipQuantity = Forms![form 2]![SHIP QUANTITY]
intOnhand = DLookup("QUANTITY", "qryUpdateField", "")
intNewOnhand = intOnhand - intShipQuantity
' now we just need to get intNewOnhand back into the table
' DoCmd.RunSQL "UPDATE [TABLE 1] SET QUANTITY=intNewOnhand where [TABLE
1].ID=FORMS![FORM 2]![LOOK ID]"
' that didnt work b/c it couldn't recognize the variable intNewOnhand
' DoCmd.RunMacro "Macro2", 1
' that still didn't work b/c the update query in the macro still
' could not recognize the variable either
please for the love of god someone help me out here.
quantity that is shipped to a customer. i've set up a tiny practice DB to
work out how to do this before i try to implement it in the real version.
i've checked the value of my variables and i can calculate the value that the
inventory needs to be set to after the ship quantity is subtracted, but i
cannot for the life of me figure out how to insert that new value
(intNewOnhand) back into my table.
here's the code so far:
Public Sub ADJUST_BUTTON_Click()
Dim intOnhand As Integer
Dim intShipQuantity As Integer
Dim intNewOnhand As Integer
intShipQuantity = Forms![form 2]![SHIP QUANTITY]
intOnhand = DLookup("QUANTITY", "qryUpdateField", "")
intNewOnhand = intOnhand - intShipQuantity
' now we just need to get intNewOnhand back into the table
' DoCmd.RunSQL "UPDATE [TABLE 1] SET QUANTITY=intNewOnhand where [TABLE
1].ID=FORMS![FORM 2]![LOOK ID]"
' that didnt work b/c it couldn't recognize the variable intNewOnhand
' DoCmd.RunMacro "Macro2", 1
' that still didn't work b/c the update query in the macro still
' could not recognize the variable either
please for the love of god someone help me out here.