Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

convert record to integer

Posted on 2013-05-23
1
Medium Priority
?
231 Views
Last Modified: 2013-05-23
In VB6 I have pulled up a recordset from a database.  The first record marked by rec.Fields(0) has a datatype which is a string.  How do I convert it to an integer?

If rec.Fields(0) = 5 Then
 'code goes here
End If
0
Comment
Question by:al4629740
1 Comment
 
LVL 20

Accepted Solution

by:
dsacker earned 2000 total points
ID: 39191534
If you are absolutely sure it will always contain a numeric value, then:

If CInt(rec.Fields(0)) = 5 Then
    ' code goes here
End If
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses

886 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question