smercer
Registered User.
- Local time
- Today, 23:11
- Joined
- Jun 14, 2004
- Messages
- 442
Hi all
I am trying to make some code to change the input mask for a ISBN Number field when the user presses a key so that it will handle all ISBN numbers.
The problem I am having is it will change on the first key press, but then I have to go into design view, or close form and reopen to make it work again.
Here is my code:
I am still working on it and need to do the other different possibilities that I might come across.
I have been doing some research on this and for more info about how the numbers and hypens go together is in the following link.
http://www.isbn.org/standards/home/isbn/international/html/usm4.htm
the end result is to make a calculation to compare the entered number to the check digit and tell the user when they enter an invalid number.
If I don't have the hyphens stored, It would be easier to find the right digit to calculate not to mention less storage needed to store all the hyphens.
I am trying to make some code to change the input mask for a ISBN Number field when the user presses a key so that it will handle all ISBN numbers.
The problem I am having is it will change on the first key press, but then I have to go into design view, or close form and reopen to make it work again.
Here is my code:
Code:
Private Sub ISBN_Number_KeyUp(KeyCode As Integer, Shift As Integer)
If (Left(Me!ISBN_Number, 1) >= 0 And Left(Me!ISBN_Number, 1) <= 7) Then
Me!ISBN_Number.InputMask = "0-00-000000-0"
End If
End If
If (Left(Me!ISBN_Number, 2) >= 80 And Left(Me!ISBN_Number, 2) <= 94) Then
Me!ISBN_Number.InputMask = "00-00-00000-0"
End If
If Left(Me!ISBN_Number, 3) >= 950 And Left(Me!ISBN_Number, 3) <= 994 Then
Me!ISBN_Number.InputMask = "000-00-0000-0"
End If
If Left(Me!ISBN_Number, 4) >= 9950 And Left(Me!ISBN_Number, 4) <= 9989 Then
Me!ISBN_Number.InputMask = "0000-00-000-0"
End If
If Left(Me!ISBN_Number, 5) >= 99900 And Left(Me!ISBN_Number, 5) <= 99999 Then
Me!ISBN_Number.InputMask = "00000-00-00-0"
End If
End Sub
I am still working on it and need to do the other different possibilities that I might come across.
I have been doing some research on this and for more info about how the numbers and hypens go together is in the following link.
http://www.isbn.org/standards/home/isbn/international/html/usm4.htm
the end result is to make a calculation to compare the entered number to the check digit and tell the user when they enter an invalid number.
If I don't have the hyphens stored, It would be easier to find the right digit to calculate not to mention less storage needed to store all the hyphens.