access field trim email to:[email protected] to [email protected] ?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a field in access with email addresses that contain mailto: before
each address. I want to remove mailto: from all the records containing email
addresses?
 
On Fri, 24 Aug 2007 16:00:02 -0700, Richard Diedrick <Richard
I have a field in access with email addresses that contain mailto: before
each address. I want to remove mailto: from all the records containing email
addresses?

Run an Update query updating the field (which I'll assume is named EMail) to

Replace(, "mailto:", "")

John W. Vinson [MVP]
 
Richard,

I have a function that I've created for use with a hyperlink field that
converts the standard entry "[email protected]#http://[email protected]#"
to an email string "johndoe#mailto:[email protected]#" If you are looking
for a more permanent method, the following function could be fairly easily
modified to change your string. Otherwise, for a one-time deal, I'm sure
John's suggestion would be much easier. Let me know if you need a hand with
the code:

***CODE START (Mine is placed in a utility module)***
Public Function pbfConvToEml(strHlink) As String
On Error GoTo Error_pbfConvToEml
'***** BODY
'
Dim strResult As String
Dim strChar As String
Dim intLen As Integer
Dim intCount As Integer
Dim intPos As Integer
Dim strAdrs As String
intLen = Len(strHlink)
strChar = Mid(strHlink, 1, 1)
intCount = 1
While Not strChar = "#"
strChar = Mid(strHlink, intCount, 1)
intCount = intCount + 1
Wend
intPos = intCount - 2
strAdrs = Mid(strHlink, 1, intPos)
strResult = strAdrs & "#mailto:" & strAdrs & "#"
pbfConvToEml = strResult
'
'***** BODY END
Exit_pbfConvToEml:
'Close variables
strResult = ""
strChar = ""
intLen = 0
intCount = 0
intPos = 0
strAdrs = ""
Exit Function
Error_pbfConvToEml:
MsgBox "Error " & Err.Number & " (" & Err.DESCRIPTION & ") in procedure
pbfConvToEml of Module modStdFrmCode"
Resume Exit_pbfConvToEml
End Function
***CODE END***
 
Back
Top