Hi,
I have small inventory system using access. When I create an invoice, shipp q'ty is subtracted from inventory.
What I want to do is if q'ty is 0 or less than shipQty, give the warning message and not to allow to create an invoice until inventory has enough q'ty.
For an Invoice Creation: frmInvoice form with sub form sfrmInvoiceDetail which has ShipQ'ty and TPbaseNo(PartNumber).
Currently, ShipQ'ty is subtracted from Current in tblProduct without checking the q'ty .
Following is my code for info.
We input the Current q'ty from form InventoryOP and saved to tblProduct.
Any help will be appreciated.
I have small inventory system using access. When I create an invoice, shipp q'ty is subtracted from inventory.
What I want to do is if q'ty is 0 or less than shipQty, give the warning message and not to allow to create an invoice until inventory has enough q'ty.
For an Invoice Creation: frmInvoice form with sub form sfrmInvoiceDetail which has ShipQ'ty and TPbaseNo(PartNumber).
Currently, ShipQ'ty is subtracted from Current in tblProduct without checking the q'ty .
Following is my code for info.
Private Sub Form_AfterUpdate()
On Error GoTo ErrorHandler
DoCmd.SetWarnings False
DoCmd.RunSQL "UPDATE tblProduct SET [Current]=[Current]-[sfrmInvoiceDetail]![ShipQ'ty]" & _
" WHERE [TPbaseNo]=[sfrmInvoiceDetail]![TPbaseNo];"
ErrorHandlerExit:
Exit Sub
ErrorHandler:
MsgBox "There was an error updating"
Cancel = True
Resume ErrorHandlerExit:
End Sub
We input the Current q'ty from form InventoryOP and saved to tblProduct.
Any help will be appreciated.