'------------------------------------------------------------
' Command14_Click
'
'------------------------------------------------------------
Private Sub Command14_Click()
On Error GoTo Command14_Click_Err
' Opens stoock check form
DoCmd.OpenForm "StockLevelCheck", acNormal, "", "", acEdit, acHidden
' Disables warning messages
DoCmd.SetWarnings False
If (Forms!StockLevelCheck!Stock <= 1) Then
' Removes stock from toner list
DoCmd.OpenQuery "cosumables-remove", acViewNormal, acEdit
DoCmd.RunCommand acCmdSaveRecord
DoCmd.Close acForm, "consumables-sell-new"
DoCmd.Close acForm, "consumables-sell-new"
End If
' enables warning messages
DoCmd.SetWarnings True
If (Forms!StockLevelCheck!Stock = 0) Then
Beep
MsgBox "Ops... None in stock!", vbExclamation, "None in stock"
End If
If (Forms!StockLevelCheck!Stock = 1) Then
Beep
MsgBox "That was the last toner!", vbExclamation, "Low stock!"
End If
DoCmd.Close acForm, "StockLevelCheck"
If (Forms!StockLevelCheck!Stock = 0) Then
DoCmd.Close acForm, "consumables-sell-new"
End If
Command14_Click_Exit:
Exit Sub
Command14_Click_Err:
MsgBox Error$
Resume Command14_Click_Exit
End Sub