Replace/Remove Digits

J

James Frater

Hello All,

I've got a txtbox "EName" which contains letters and digits, if possible, as
the control source of another txtbox I'd like to use the Replace Function to
strip out the digits.

Is this possible? I've been using:

Replace([ename], ?help?, "",1,-1,0)

But it doesn't quite work, any thoughts?

thanks

James
 
A

Al Campagna

James,
I've got a txtbox "EName" which contains letters and digits,
That doesn't tell us much...

Please give several examples of the data you have... vs. what
you want to see.
Also describe any logic that always holds true of your original EName.
Example: It always has 3 numbers, then 4 letters... etc...
--
hth
Al Campagna
Microsoft Access MVP
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your life."


James Frater said:
Hello All,

I've got a txtbox "EName" which contains letters and digits, if possible,
as
the control source of another txtbox I'd like to use the Replace Function
to
strip out the digits.

Is this possible? I've been using:

Replace([ename], ?help?, "",1,-1,0)

But it doesn't quite work, any thoughts?

thanks

James
 
J

James Frater

Hi Al,

Certainly. EName is the name of an event which includes the year, please see
below for some examples.

Thanks

James

Rugby Masters 2009 becomes Rugby Masters
Junior Hockey 2007 becomes Junior Hockey
Summer Cricket 2008 becomes Summer Cricket


Al Campagna said:
James,
I've got a txtbox "EName" which contains letters and digits,
That doesn't tell us much...

Please give several examples of the data you have... vs. what
you want to see.
Also describe any logic that always holds true of your original EName.
Example: It always has 3 numbers, then 4 letters... etc...
--
hth
Al Campagna
Microsoft Access MVP
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your life."


James Frater said:
Hello All,

I've got a txtbox "EName" which contains letters and digits, if possible,
as
the control source of another txtbox I'd like to use the Replace Function
to
strip out the digits.

Is this possible? I've been using:

Replace([ename], ?help?, "",1,-1,0)

But it doesn't quite work, any thoughts?

thanks

James
 
K

KARL DEWEY

Try this --
Replace([EName], " 2009","") to remove 'space' 2009 from EName.
--
Build a little, test a little.


James Frater said:
Hi Al,

Certainly. EName is the name of an event which includes the year, please see
below for some examples.

Thanks

James

Rugby Masters 2009 becomes Rugby Masters
Junior Hockey 2007 becomes Junior Hockey
Summer Cricket 2008 becomes Summer Cricket


Al Campagna said:
James,
I've got a txtbox "EName" which contains letters and digits,
That doesn't tell us much...

Please give several examples of the data you have... vs. what
you want to see.
Also describe any logic that always holds true of your original EName.
Example: It always has 3 numbers, then 4 letters... etc...
--
hth
Al Campagna
Microsoft Access MVP
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your life."


James Frater said:
Hello All,

I've got a txtbox "EName" which contains letters and digits, if possible,
as
the control source of another txtbox I'd like to use the Replace Function
to
strip out the digits.

Is this possible? I've been using:

Replace([ename], ?help?, "",1,-1,0)

But it doesn't quite work, any thoughts?

thanks

James
 
J

John W. Vinson

Hello All,

I've got a txtbox "EName" which contains letters and digits, if possible, as
the control source of another txtbox I'd like to use the Replace Function to
strip out the digits.

Is this possible? I've been using:

Replace([ename], ?help?, "",1,-1,0)

But it doesn't quite work, any thoughts?

thanks

James

If you want to strip all digits, not just a particular sequence, you'll need
to use either ten nested Replace calls:

Replace(Replace(Replace([ename], "0", ""), "1", ""), "2", "")

expanded; this may well run into limits on the complexity of expressions. Or
you could use a custom VBA function:

Public Function StripDigits(strIn As String) As String
Dim iPos As Integer
StripDigits = ""
For iPos = 1 to Len(strIn)
If IsNumeric(Mid(strIn, iPos, 1)) Then
' do nothing
Else
' include this character in the output
StripDigits = StripDigits & Mid(strIn, iPos, 1)
End If
Next iPos
End Function

Inelegant, probably slow, and untested but should give you a start.
 
A

Al Campagna

James,
Try...
=Left([EName],Len([EName])-5)
That will work wheteher the year is 2007, or 2009, etc...
--
hth
Al Campagna
Microsoft Access MVP
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your life."

James Frater said:
Hi Al,

Certainly. EName is the name of an event which includes the year, please
see
below for some examples.

Thanks

James

Rugby Masters 2009 becomes Rugby Masters
Junior Hockey 2007 becomes Junior Hockey
Summer Cricket 2008 becomes Summer Cricket


Al Campagna said:
James,
I've got a txtbox "EName" which contains letters and digits,
That doesn't tell us much...

Please give several examples of the data you have... vs. what
you want to see.
Also describe any logic that always holds true of your original
EName.
Example: It always has 3 numbers, then 4 letters... etc...
--
hth
Al Campagna
Microsoft Access MVP
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your
life."


James Frater said:
Hello All,

I've got a txtbox "EName" which contains letters and digits, if
possible,
as
the control source of another txtbox I'd like to use the Replace
Function
to
strip out the digits.

Is this possible? I've been using:

Replace([ename], ?help?, "",1,-1,0)

But it doesn't quite work, any thoughts?

thanks

James
 

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

Top