help with If/Else

G

Guest

I have a statement that BruceM was kind enough to supply, and it was working
beautifully until a recent change.

What it does is mimic the auto number function and makes sure the 2nd to
last number is never a zero....or at least it used to.

Private Sub AssignBarcode_Click()

If Right(DMax("barcodeID", "barcodes"), 2) = 9 Then

Me.barcodeID = Format(Left(DMax("barcodeID", "barcodes"), 5) + 2,
"00000") & "0"
Else
Me.barcodeID = Format(Left(DMax("barcodeID", "barcodes"), 5) +
1, "00000") & "0"
End If

End Sub

When I have this running in the forms current event it works fine. However,
I need to be able to copy a record and adjust the ending zero that it
appends. So, in order to do that, per Bruce's guidence; I've tied this
function to a command button to "assign" the number. The only problem is
that now it doesn't add 2 when the number reaches 9, any idea why?

Thank you!!!
dl
 
G

Guest

Might be nothing to do with it but shouldn't your first Right function have 1
as the second argument rather than 2? Only the last one digit can be 9.
 
G

Guest

no, I actually needed the 2nd to the last digit to increment and leave the
last digit a zero.

thanks for checking tho!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top