Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Database Design / January 2005

Tip: Looking for answers? Try searching our database.

isbn check diget

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
blackcat - 06 Jan 2005 14:01 GMT
im trying to calculate the check diget for an isbn number, i know the theory
of doing this, i need to take each individual number and multiply it with a
weighting number.  my problem is, i'd like to put the isbn number in as a
whole field, ie 156054021, does anyone know how to pull off each indivutual
number, ie in a loop, 1st time round pull off the 1 and * by 7, then the 5
and * by 6, then the 6, then the 0 etc.
Tim Ferguson - 06 Jan 2005 16:44 GMT
> i'd like to put the isbn number in as a
> whole field, ie 156054021, does anyone know how to pull off each
> indivutual number, ie in a loop, 1st time round pull off the 1 and *
> by 7, then the 5 and * by 6, then the 6, then the 0 etc.

 strNumber = format(dwISBN, "000000000")
 for p = 1 ot len(strNumber)
   wDigit = CInt(mid(strNumber,p,1))
   Debug.Print wDigit
   ' or do something useful with it
 next p

Hope that helps

Tim F
blackcat - 07 Jan 2005 10:29 GMT
thanks, i'll give that a go

> > i'd like to put the isbn number in as a
> > whole field, ie 156054021, does anyone know how to pull off each
[quoted text clipped - 11 lines]
>
> Tim F
blackcat - 07 Jan 2005 14:51 GMT
sorry to be a pain, but the code you gave me doesn't give me each indivual
number from the string seperatly, so that i can do a multiplication on each
seperate number, any more ideas please, thanks

> im trying to calculate the check diget for an isbn number, i know the theory
> of doing this, i need to take each individual number and multiply it with a
> weighting number.  my problem is, i'd like to put the isbn number in as a
> whole field, ie 156054021, does anyone know how to pull off each indivutual
> number, ie in a loop, 1st time round pull off the 1 and * by 7, then the 5
> and * by 6, then the 6, then the 0 etc.
Tim Ferguson - 07 Jan 2005 17:47 GMT
> sorry to be a pain, but the code you gave me doesn't give me each
> indivual number from the string seperatly, so that i can do a
> multiplication on each seperate number, any more ideas please,

I am guessing that this was meant to be a response to me: it helps if you
can stick messages on the end of the thread :-)

The code I suggested does indeed shell out individual digits -- you may
want an algorithm something like this

 ' put in a dummy element (0) to help indexing later on
 varMultiplier = Array(Null,2,3,4,2,3,4,6,7,8)

 ' force the number into nine digits
 strNumber = format(dwISBN, "000000000")

 ' prepare the accumulator
 dwCheckSum = 0

 ' shell out individual digits
 for p = 1 to len(strNumber) ' always 1 to 9...

   ' we need a number not a char
   wDigit = CInt(mid(strNumber,p,1))

   ' multiply it and add it in    
   dwCheckSum = dwCheckSum + wDigit * varMultiplier(p)

 next p

 Debug.print "Checksum = " & dwCheckSum

Does that not do it for you?

Tim F
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.