Advertisement

05.08.2003 at 11:26AM PDT, ID: 20610293
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

8.6

Convert string to number using VB / VBScript

Asked by Mckenzma in Active Server Pages (ASP)

Tags: , , ,

I'm trying to create a serialized identification string, where the first 4 characters are letters and the last 5 characters are numbers.  To create a new ID, I get the maximum ID string from the database, extract the final 5 characters (which are in the form 00001, 00002, etc.), convert them to a number, add 1, and re-build a 9-character string using the new number.  My problem lies in converting the characters to a number; val() doesn't work and cint() requires a number input (I've tried it here and it doesn't work).  Is there a way to convert a string to a number value in VB Script?

Here's my code:

   strSQL = "Select max(ID) as Alumni_ID from RUNNERS.Ath_Profile where ID like " & CHR(39) & "Alum%" & CHR(39)  
   Set AlumData = nothing
   Set AlumData = Currdb.CreateDynaset(strSQL,4)
   AlumData.MoveFirst
   MaxAlumID = AlumData.Fields("Alumni_ID")
   If IsNull(MaxAlumID) Then
     AlumSeqNum = 1 'This covers the first record inserted to the database
   Else
     AlumSeqNum = Val(Right(CStr(MaxAlumID)), 5) + 1 'This is the command that fails.
   End If
   vAlumSerial = "0000" & Trim(CStr(AlumSeqNum))
   vAlumSSO = "Alum" & Right(vAlumSerial, 5) 'Re-build ID string with new serial number

Any help would be greatly appreciated, thanks!

mckenzma
Start Free Trial
 
 
Loading Advertisement...
 
[+][-]05.08.2003 at 11:29AM PDT, ID: 8490894

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.08.2003 at 11:30AM PDT, ID: 8490895

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.08.2003 at 11:31AM PDT, ID: 8490900

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Active Server Pages (ASP)
Tags: vbscript, string, convert, number
Sign Up Now!
Solution Provided By: fritz_the_blank
Participating Experts: 3
Solution Grade: B
 
 
[+][-]05.08.2003 at 11:31AM PDT, ID: 8490901

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.08.2003 at 05:27PM PDT, ID: 8492636

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.08.2003 at 07:12PM PDT, ID: 8492970

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.09.2003 at 06:39PM PDT, ID: 8498068

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.10.2003 at 05:23AM PDT, ID: 8499777

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32