?
Solved

the code please

Posted on 2003-03-03
1
Medium Priority
?
134 Views
Last Modified: 2010-05-01
Hi,

Dim sVar As String, iVar As Integer
sVar = “A 1-12-15”

What is the function (or code) which lets iVar = 15  
(I mean the last number after “-“ , this number should be any number from 1 to 999999)

thanx
0
Comment
Question by:asns
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 6

Accepted Solution

by:
marconovaro earned 200 total points
ID: 8056539

Here it is:

Private Sub Form_Load()

Dim sVar As String, iVar As Long

sVar = "A 1-12-356425"

iVar = Val(Right$(sVar, Len(sVar) - InStrRev(sVar, "-", , vbTextCompare)))

End Sub

Please note that you'll need a long variable to store 999999... :)

M
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
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
Course of the Month14 days, 16 hours left to enroll

770 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