Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VB functions 1

Status
Not open for further replies.

irisha2

Technical User
Feb 19, 2002
9
US
I'm new to programming world. Can somebody help me with the problem below?

Suppose, I have a name in a field or variable that is in the "last,first" name format. What function could break it into separate variables for first and last names?
How to perform this task the best?

Does somebody know where on Internet I can get free VB tutorial?

Any help will be much appreciated.

Thanks in advance.

Irina
 
There are several ways to do what you are trying to do. Place this code in a command button on a form

Private Sub Command1_Click()
Dim s As String
Dim f As String
Dim l As String
Dim arr() As String

s = "last,first"
arr = Split(s, ",", , vbBinaryCompare)
l = arr(0)
f = arr(1)

Print l
Print f
End Sub

You could also look at Left() and Right() functions as well.

Hope this helps. Anything is possible, the problem is I only have one lifetime.
[cheers]
 
Thanks for help with that...

I have another question...

Should I use Left() and Right() functions when I want to compare two character strings (to know whether they match)?

I can not find any information on string functions...


 
No, just put them through an If Then Statement, example:

Code:
if strMyString = "Wibble" then

  'Code to run if it is the same
else

  'Code to run if it is not

end if

 
Thank you, guys

I found a good Visual Basic tutorial using links you sent.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top