R
RJB
In a database for a printing company, I've got a form that has a field
for "Quantity" ordered and "Finished" total pieces created. When an
order is written up the "Quantity" is filled in and the order goes
into production. Once production is finished, a final count is taken
including all extras and that count is entered into "Finished". Once
"Finished" is updated and the user tries to exit the "Finished" box, a
calculation is done to make sure the the value of "Finished" is not
less than the value of "Quantity". Generally, we run everything
multiple up, so if 100 pieces are ordered, the value in "Quantity"
would be 50 for a job that will run 2 per sheet, and the "Finished"
entry would be 102 (for a couple extras).
It's worked fine on most jobs, but today I found that a job with
"Quantity" of 50 with "Finished" of more than 99 will return a
negative value and cause the form to disallow saving until that error
is corrected. SO, if I enter any value less than 50, it fails (as it
should). If I enter a value of 50 - 99, it works. But, if I enter
anything over 100, it fails and a message box (which I created) pops
up saying we need to run -50 (or whatever) more.
Any idea why that would happen. I'd think it would happen on anything
over 50 - but it only triggers when the "Finished" value entered is
100 or greater.
Here is the code. There's probably an obvious mistake I'm missing,
but any help is greatly appreciated.
Private Sub FinTotal_Exit(Cancel As Integer)
RunCommand acCmdSaveRecord
If [FinTotal] < [Quantity] Then
Cancel = True
MsgBox "Please let Jim know that " & ([Quantity] - [FinTotal]) & "
more prints are needed."
Else
Cancel = False
End If
Me.FinTotalEmp.SetFocus
End Sub
for "Quantity" ordered and "Finished" total pieces created. When an
order is written up the "Quantity" is filled in and the order goes
into production. Once production is finished, a final count is taken
including all extras and that count is entered into "Finished". Once
"Finished" is updated and the user tries to exit the "Finished" box, a
calculation is done to make sure the the value of "Finished" is not
less than the value of "Quantity". Generally, we run everything
multiple up, so if 100 pieces are ordered, the value in "Quantity"
would be 50 for a job that will run 2 per sheet, and the "Finished"
entry would be 102 (for a couple extras).
It's worked fine on most jobs, but today I found that a job with
"Quantity" of 50 with "Finished" of more than 99 will return a
negative value and cause the form to disallow saving until that error
is corrected. SO, if I enter any value less than 50, it fails (as it
should). If I enter a value of 50 - 99, it works. But, if I enter
anything over 100, it fails and a message box (which I created) pops
up saying we need to run -50 (or whatever) more.
Any idea why that would happen. I'd think it would happen on anything
over 50 - but it only triggers when the "Finished" value entered is
100 or greater.
Here is the code. There's probably an obvious mistake I'm missing,
but any help is greatly appreciated.
Private Sub FinTotal_Exit(Cancel As Integer)
RunCommand acCmdSaveRecord
If [FinTotal] < [Quantity] Then
Cancel = True
MsgBox "Please let Jim know that " & ([Quantity] - [FinTotal]) & "
more prints are needed."
Else
Cancel = False
End If
Me.FinTotalEmp.SetFocus
End Sub