473,405 Members | 2,261 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

extracting specific words to different fields automatically

hi guys,
i was wondering if it is possible to extract selected words in a
field to be put in different fields automatically. Do i have to write
the code in vb?

This is what im trying to do. Write now, i have emails that i
receive in outlook and i want to transfer them into a database. I
realized that i could export this. however, the BODY section of the
email is exported as one field. As the email i receive is a template
and it is always in a specific form. Is there anyway i can extract the
data and place them into different fields?

Thanks.
Nov 13 '05 #1
2 2144
On 5 Sep 2004 22:13:00 -0700, br********@gmail.com (Branden) wrote:

Yes, you'll have to write some VBA code to parse the Body text.
Assuming this is your body text:

FirstName: Tom<CRLF>
LastName: van Stiphout<CRLF>
<etc>

Note that <CRLF> stands for a carriage return / linefeed pair of
characters, the typical (invisible) separator characters between two
lines of text.

Now write code like this (note: air code ahead):

Sub WriteBodyToDb(byval strBody as string)
dim strFirstName as string
dim strLastName as string
strFirstName=GetFieldValue(strBody, "FirstName: ")
strLastName=GetFieldValue(strBody, "LastName: ")
'etc.

'TODO: Write the values to the Db. Perhaps using a recordset, or an
Append query.
end sub

private function GetFieldValue(byval strBody as string, byval
strFieldHeader as string)
dim intStartOfField as integer
dim strField as string
intStartOfField=GetStartOfFieldValue(strBody, strFieldHeader)
if intStartOfField>0 then
strField=Mid$(strBody, intStartOfField, Instr(intStartOfField,
strBody, vbCrLf))
GetFieldValue=strField
end function

private function GetStartOfFieldValue(byval strBody as string, byval
strFieldHeader as string)
dim intPos as integer
intPos=instr(strBody, strFieldHeader)
if intPos>0 then intPos=intPos+len(strFieldHeader)
GetStartOfFieldValue=intPos
end function

Happy coding!
-Tom.

hi guys,
i was wondering if it is possible to extract selected words in a
field to be put in different fields automatically. Do i have to write
the code in vb?

This is what im trying to do. Write now, i have emails that i
receive in outlook and i want to transfer them into a database. I
realized that i could export this. however, the BODY section of the
email is exported as one field. As the email i receive is a template
and it is always in a specific form. Is there anyway i can extract the
data and place them into different fields?

Thanks.


Nov 13 '05 #2
Thanks a bunch. I'll give it a try.

branden

Tom van Stiphout <no*************@cox.net> wrote in message news:<ln********************************@4ax.com>. ..
On 5 Sep 2004 22:13:00 -0700, br********@gmail.com (Branden) wrote:

Yes, you'll have to write some VBA code to parse the Body text.
Assuming this is your body text:

FirstName: Tom<CRLF>
LastName: van Stiphout<CRLF>
<etc>

Note that <CRLF> stands for a carriage return / linefeed pair of
characters, the typical (invisible) separator characters between two
lines of text.

Now write code like this (note: air code ahead):

Sub WriteBodyToDb(byval strBody as string)
dim strFirstName as string
dim strLastName as string
strFirstName=GetFieldValue(strBody, "FirstName: ")
strLastName=GetFieldValue(strBody, "LastName: ")
'etc.

'TODO: Write the values to the Db. Perhaps using a recordset, or an
Append query.
end sub

private function GetFieldValue(byval strBody as string, byval
strFieldHeader as string)
dim intStartOfField as integer
dim strField as string
intStartOfField=GetStartOfFieldValue(strBody, strFieldHeader)
if intStartOfField>0 then
strField=Mid$(strBody, intStartOfField, Instr(intStartOfField,
strBody, vbCrLf))
GetFieldValue=strField
end function

private function GetStartOfFieldValue(byval strBody as string, byval
strFieldHeader as string)
dim intPos as integer
intPos=instr(strBody, strFieldHeader)
if intPos>0 then intPos=intPos+len(strFieldHeader)
GetStartOfFieldValue=intPos
end function

Happy coding!
-Tom.

hi guys,
i was wondering if it is possible to extract selected words in a
field to be put in different fields automatically. Do i have to write
the code in vb?

This is what im trying to do. Write now, i have emails that i
receive in outlook and i want to transfer them into a database. I
realized that i could export this. however, the BODY section of the
email is exported as one field. As the email i receive is a template
and it is always in a specific form. Is there anyway i can extract the
data and place them into different fields?

Thanks.

Nov 13 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Ian Rastall | last post by:
Ah, I hope it's okay to keep posting questions, and sorry for the vague subject line. This is my problem: I've got a database set up with 7 fields: ID, Album, Year, Type, Songs, Members,...
2
by: Steve | last post by:
Hi, I have a very long string, someting like: DISPLAY=localhost:0.0,FORT_BUFFERED=true, F_ERROPT1=271\,271\,2\,1\,2\,2\,2\,2,G03BASIS=/opt/g03b05/g03/basis,...
1
by: hriceb | last post by:
I know about the SendObject command but I think my question is a bit different. I have TableA that includes FName, LName, etc... and EMail. Generally, data is entered / changed via FormA I...
1
by: ANSWER | last post by:
I have two tables with words. First table has 2 fields: German, Croatian. Second table has 2 fields: German, English. First table in the German field miss attributes (der, die, das), (pl). This...
1
by: Richard Hollenbeck | last post by:
Hello Newsgroup. You have all been very helpful in the past and I thank you. I try to ask relevant questions so that they don't just benefit me, but also benefit the group. I'm currently...
8
by: james | last post by:
I am trying to use Filestream to read a file ( .DAT) that contains values in HEX that I want to convert to text. I know the different offset addresses for each portion of the data I am trying to...
4
by: apatel85 | last post by:
Hey Guys, Total Number of Records (Based on 5 fields): 1000 Total Unique Records (Based on 5 Fields): 990 Total number of fields: 5 I have question regarding extracting duplicates from the...
22
by: sivadhanekula | last post by:
Hello Everyone A quick and direct question: I need a C/C++ program to extract the data from the database and the output should be in CSV "Comma Separated Value" format. Briefly: I will be given a...
11
by: Ebenezer | last post by:
Let's suppose I have some nodes in an XML file, with an URL attribute: <node url="mypage.php?name1=value1&foo=bar&foo2=bar2&name2=value0" /> <node...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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...
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,...
0
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...

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.