473,473 Members | 2,120 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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

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
2 4954
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Arjen | last post by:
Hi All, What I want to is using a string as PATTERN in a split function. This makes it possible for me to change the PATTERN on one place in my script... For example: $separator = ";"; $line...
0
by: j | last post by:
Hi, Anyone out there with binary search tree experience. Working on a project due tomorrow and really stuck. We need a function that splits a binary tree into a bigger one and smaller one(for a...
3
by: Reb | last post by:
Hi, I could split only by a character. How do i split by a string. How can i do something like this. e.g., somestring.Split("name"); Thanks Reb
2
by: Elhanan | last post by:
hi all.. i have the following string: 200850625~01~464~^^200850625~01~464~^^200850625~01~908~^^ which i will need to turn to a mutli-dimentional string array i used result.Split(new...
4
by: John | last post by:
Hi I need to return an array of string in my own split function (access 97). I have defined the function as below but I get err on 'As String()'. What can I do to make the function return an...
11
by: pmarisole | last post by:
I am trying to use the vbscript "split" function on a multi-select field. I am trying to do a mass update of several records at a time. I am getting an error and I'm not sure what to do. Here is...
3
by: HopfZ | last post by:
How can I create a function nF such that for example var sum = nF('a','b','return a+b'); and var sum = new Function('a','b','return a+b'); do the same? function nF(){ return new...
6
by: Dasn | last post by:
Hi, there. 'lines' is a large list of strings each of which is seperated by '\t' I wanna split each string into a list. For speed, using map() instead of 'for' loop. 'map(str.split, lines)'...
16
by: pereges | last post by:
It is not explained well in my manual. can someone please tell me about it ? Is qsort the best sorting algorithm out there ?
1
by: John | last post by:
Hi I have written a Split function which in turn calls the standard string split function. Code is below; Function Split1(ByVal Expression As String, Optional ByVal Delimiter As String = " ",...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.