Results 1 to 8 of 8
  1. #1
    Lounger
    Join Date
    Jan 2005
    Location
    Colorado Springs, Colorado, USA
    Posts
    44
    Thanks
    0
    Thanked 0 Times in 0 Posts

    ISBN format (2000)

    Hi All

    Does anyone know a good format for ISBN? The leading "0" and the sometimes final "X" cause me a problem. Any suggestions?

    Thom
    just a pup

  2. #2
    Platinum Lounger
    Join Date
    Jan 2001
    Location
    Quedgeley, Gloucester, England
    Posts
    5,333
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: ISBN format (2000)

    Don't forget the final character (values 0-9 and X) is a check digit... Suggest you Google on ISBN check digit for all sorts of technical info!

    John
    <font face="Script MT Bold"><font color=blue><big><big>John</big></big></font color=blue></font face=script>

    Ita, esto, quidcumque...

  3. #3
    Lounger
    Join Date
    Jan 2005
    Location
    Colorado Springs, Colorado, USA
    Posts
    44
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: ISBN format (2000)

    John

    Thanks for the info but I need help with the formatting now. And, this situation could extend way past 2007.

    Thom

  4. #4
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: ISBN format (2000)

    You can only format it as a string, so what specifically do you need help on?
    Charlotte

  5. #5
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 28 Times in 28 Posts

    Re: ISBN format (2000)

    The following is for a 10 digit ISBN number.

    You can use an input mask 000000000>A and you can use the following function to test for a valid ISBN number:

    Function TestISBN(ISBN) As Boolean
    Dim i As Integer, Sum11 As Integer, Checksum As String
    If Not IsNull(ISBN) Then
    Sum11 = 0
    For i = 1 To 9
    Sum11 = Sum11 + (11 - i) * Val(Mid$(ISBN, i, 1))
    Next
    Checksum = CStr((495 - Sum11) Mod 11)
    If Checksum = "10" Then Checksum = "X"
    If Right(ISBN, 1) <> Checksum Then
    MsgBox "The last character of the ISBN number is incorrect." & vbCrLf & _
    "If the first nine characters are correct, the last one should be '" & _
    Checksum & "'.", vbInformation
    TestISBN = True
    End If
    End If
    End Function

    This function returns TRUE if there is a problem. You could use it in the Before Update event of a text box:

    Private Sub txtISBN_BeforeUpdate(Cancel As Integer)
    Cancel = TestISBN(Me.txtISBN)
    End Sub

  6. #6
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Niagara Falls, New York, USA
    Posts
    1,877
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: ISBN format (2000)

    Nice code

    I tried the following without success

    Am I doing something wrong?

    Thanks, John

    ?TestISBN ("0-7356-2039-3")
    True
    The last character of the ISBN number is incorrect.
    If the first nine characters are correct, the last one should be 0


    ?TestISBN ("0-7645-3365-7")
    True
    The last character of the ISBN number is incorrect.
    If the first nine characters are correct, the last one should be 3

  7. #7
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 28 Times in 28 Posts

    Re: ISBN format (2000)

    My code was for an ISBN number without dashes inserted. If you want the dashes to be displayed but not stored, you can use an input mask
    <code>0-0000-0000->A;;_</code>
    and keep the code "as is".
    If you want to store the dashes, the input mask would be
    <code>0-0000-0000->A;0;_</code>
    and the code would have to be adjusted to take the dashes into account.

  8. #8
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Niagara Falls, New York, USA
    Posts
    1,877
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: ISBN format (2000)

    Sorry, should of studied your code

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •