Is there a function, or a combination of functions, in MS Access 2007 that will allow me to extract part of a string?
I have a database text field "Email" that contains a person's name and email address enclosed in brackets. Not all field values have a name, but each has an email address contained by brackets. Here are 3 example field values:
John Smith <johnsmith@emai l.com>
<marysmith@emai l.com>
Willard Smith <willardjsmith@ email.com>
What I want is to extract is the email address from between the brackets. The email address is always in the brackets as shown above.
Any advice or suggestions you can offer would be greatly appreciated.
2 7434
Are you looking for a solution using SQL or VB?
if VB then, not sure if there is an easier way to do this but you could use a combination of the InStr() function and the Substring() function...
something like this: -
-
Dim s As String
-
s = Text1.Value 'THIS IS THE WHOLE STRING
-
-
Dim i1 As Integer = InStr(s, "<")
-
Dim i2 As Integer = InStr(s, ">")
-
Dim MyEmail As String = s.Substring(i1, i2 - (i1 + 1))
-
MsgBox(MyEmail)
ADezii 8,834
Recognized Expert Expert - Function Definition:
- Public Function fExtractEMailAddr(strString As String) As Variant
-
If InStr(strString, "<") > 0 And InStr(strString, ">") > 0 Then
-
fExtractEMailAddr = Mid$(strString, InStr(strString, "<") + 1, _
-
(InStr(strString, ">") - InStr(strString, "<")) - 1)
-
Else
-
fExtractEMailAddr = Null
-
End If
-
End Function
- Sample Function Calls and Results:
- Debug.print fExtractEMailAddr("Willard Smith <willardjsmith@email.com>")
-
'will yield
-
willardjsmith@email.com
- Debug.print fExtractEMailAddr("Willard Smith <willardjsmith@email.com")
-
'will yield (missing '>')
-
Null
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Lauren Quantrell |
last post by:
Is there anyway to extract part of a string in a stored procedure
using a parameter as the starting point?
For example, my string might read: x234y01zx567y07zx541y04z
My Parameter is an nvarchar and the value is: "x567y"
What I want to extract is the two charachters after the parameter, in
this case "07".
Can anyone shed some light on this problem?
Thanks,
lq
|
by: rdraider |
last post by:
Is there a function that will extract part of a string when the data you
want does not occur in a specific position?
Field "REF" is varchar(80) and contains an email subject line and the email
recipients contact name
Example data:
Rec_ID REF
1 Here is the information you requested (oc:Johm
Smith)
2 Thanks for attending our seminar (oc:Peggy Sue
Johnson)
|
by: Joe |
last post by:
I'm trying to extract part of html code from a tag to a tag code begins
with <span class="boldyellow"><B><U> and ends with
TD><TD> <img src="http://whatever/some.gif"> </TD></TR></TABLE>
I was thinking of using a regular expression however I having hard time
getting the desired string. I use
htmlSource = urllib.urlopen("http://address/")
s = htmlSource.read()
htmlSource.close()
|
by: Patrick Sullivan |
last post by:
I am trying to extract two parts of a number from an array element. Numbers
are in the format of 1.10, 2.50, 11.10, etc. Floor and ceiling won't work
right because close to 1.00, I get a zero, and I need the actual integer
part and the fraction part as an int, too.. TIA
here is the data
fields(0) = "Alena Sobran"
fields(1) = "4/4/1977"
|
by: teo |
last post by:
hallo,
I need to extract a word and few text that
precedes and follows it (about 30 + 30 chars)
from a long textual document.
Like the description that Google returns when
it has found a given word.
In example from:
| |
by: flit |
last post by:
Hello All,
Using poplib in python I can extract only the headers using the .top,
there is a way to extract only the message text without the headers?
like remove the fields below:
"
Return-Path:
X-Original-To:
Received: from
|
by: erikcw |
last post by:
Hi all,
I'm trying to extract zip file (containing an xml file) from an email
so I can process it. But I'm running up against some brick walls.
I've been googling and reading all afternoon, and can't seem to figure
it out.
Here is what I have so far.
p = POP3("mail.server.com")
|
by: Alberto Sartori |
last post by:
Hello,
I have a html text with custom tags which looks like html comment,
such:
"text text text <p>text</ptext test test
text text text <p>text</ptext test test
<!-- @MyTag@ -->extract this<!-- /@MyTag@ -->
text text text <p>text</ptext test test
<!-- @MyTag@ -->and this<!-- /@MyTag@ -->
text text text <p>text</ptext test test"
|
by: Edwin.Madari |
last post by:
from each line separate out url and request parts. split the request into key-value pairs, use urllib to unquote key-value pairs......as show below...
import urllib
line = "GET...
|
by: MaryJolly |
last post by:
I want to extract number part from a string. I am doing project in VB6 and my MSFlexGrid control contains certain codes in the first column.eg. EC101,CS104,etc. I want to extract the number part from the text.
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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 then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
| |
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |