By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,027 Members | 1,271 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,027 IT Pros & Developers. It's quick & easy.

function(s) to split an e-mail address into user and host

P: n/a
Hi. Sorry if this is an old question, but....

i have a table that includes an e-mail address

in a query, i would like to create two columns with expressions for
the hostname and the username.

what function(s) would i use to split the e-mail address to what comes
before the @ and what comes after?

thanks,

Larry
- - - - - - - - - - - - - - - - - -
"Forget it, Jake. It's Chinatown."
Nov 12 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
UserName = Left([EmailAddress],InStr([EmailAddress],"@")-1))
HostName = Mid([EmailAddress],Len([UserName])+1)
--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
re******@pcdatasheet.com
www.pcdatasheet.com
"bender" <larry@netgeexdotcom> wrote in message
news:m4********************************@4ax.com...
Hi. Sorry if this is an old question, but....

i have a table that includes an e-mail address

in a query, i would like to create two columns with expressions for
the hostname and the username.

what function(s) would i use to split the e-mail address to what comes
before the @ and what comes after?

thanks,

Larry
- - - - - - - - - - - - - - - - - -
"Forget it, Jake. It's Chinatown."

Nov 12 '05 #2

P: n/a
Tom
On Mon, 09 Feb 2004 14:24:55 -0800, bender <larry@netgeexdotcom>
wrote:

Public Function EmailOK(ByVal Email As String) As Boolean
If Email Like "*@*" And (Email Like "*.com" Or Email Like "*.net")
Then EmailOK = True
End Function

Public Function EmailPart(ByVal Email As String, Part As Boolean) As
String
Dim Pos As Integer ' @ position
If Not EmailOK(Email) Then Exit Function ' if not valid address, exit
Pos = InStr(1, Email, "@") ' get @ position
If Part = True Then ' if user name part
EmailPart = Left$(Email, Pos - 1) ' return user name
Else ' if domain part
EmailPart = Right$(Email, Len(Email) - Pos) ' return domain
End If ' if user name part
End Function

Hi. Sorry if this is an old question, but....

i have a table that includes an e-mail address

in a query, i would like to create two columns with expressions for
the hostname and the username.

what function(s) would i use to split the e-mail address to what comes
before the @ and what comes after?

thanks,

Larry
- - - - - - - - - - - - - - - - - -
"Forget it, Jake. It's Chinatown."


Nov 12 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.