using isnumeric

J

Joey

I am using an import process that scans an html file and exports data to
a sql database table.

One of the fields I import, on occasion has 2 numeric characters at the
very end. For example "thename 04".

What I need to do is delete those numeric characters, if they exist.

I thought about something like this:
if isnumeric(right(thename,2))=TRUE then

....but what's next? How do I make a new THENAME field without those
last two numeric characters if they exist?

Thanks for the help!
 
B

Bob Barrows [MVP]

Joey said:
I am using an import process that scans an html file and exports data
to a sql database table.

One of the fields I import, on occasion has 2 numeric characters at
the very end. For example "thename 04".

What I need to do is delete those numeric characters, if they exist.

I thought about something like this:
if isnumeric(right(thename,2))=TRUE then

...but what's next? How do I make a new THENAME field without those
last two numeric characters if they exist?


To do it in vbscript, you would do this:

thename = left(thename,len(thename)-2)


Bob Barrows
 
M

Manohar Kamath

You say "if they exist" -- meaning they may not? If so, you could do the
following:

Dim stringArray
dim namePart

' Split the string on the empty space
stringArray = Split(theName, " ")

' Retrieve the string before the space. if the space does not
' exist, you will get the entire string
namePart = stringArray(0)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,021
Latest member
AkilahJaim

Latest Threads

Top