string fuction

  • Thread starter Thread starter Tom B. Cruise
  • Start date Start date
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.
 
Cheryl,

But this function will take the specified position which is a
variable to my case.
 
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
 
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)
 
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)
 
Back
Top