string fuction

T

Tom B. Cruise

Given a field with string datatype. How can I write a fuction which will
take this field as input and output a string like following?

example 1,

(e-mail address removed) --> input


yahoo.com --> output


example 2,

(e-mail address removed) --> input


netvigator.com ---> output




P.S. I want to use this in a query. Thanks.
 
T

Tom B. Cruise

Cheryl,

But this function will take the specified position which is a
variable to my case.
 
R

Ron Weiner

Try using Mid() with InStr() and Len() like this:

YourString = Mid("(e-mail address removed)" ,InStr("(e-mail address removed)" ,"@")
+1,Len("(e-mail address removed)") -InStr("(e-mail address removed)" ,"@"))

Ron W
 
D

Dirk Goldgar

Ron Weiner said:
Try using Mid() with InStr() and Len() like this:

YourString = Mid("(e-mail address removed)" ,InStr("(e-mail address removed)" ,"@")
+1,Len("(e-mail address removed)") -InStr("(e-mail address removed)" ,"@"))

And in fact you don't need the third argument to Mid(), so you can just
write

YourString = _
Mid("(e-mail address removed)", InStr("(e-mail address removed)","@") +1)
 
T

Tom B. Cruise

Thanks, gentlemen. That help a lot.


Dirk Goldgar said:
And in fact you don't need the third argument to Mid(), so you can just
write

YourString = _
Mid("(e-mail address removed)", InStr("(e-mail address removed)","@") +1)

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)
 

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