473,385 Members | 1,492 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,385 software developers and data experts.

Search within a file

Scenario:

I have a database with user account information, including their
status. Due to different circumstances, we disable these user
accounts. First, we send them a warning e-mail and then a suspension
notification e-mail, through Outlook. All these .msg's (Outlook
E-mails) are saved in the same place. All the messages have the same
text, except the username.

Question:

My question is... Is it possible, within MS Access, to search WITHIN a
file for keywords (in this case the username). The desired outcome
would be to have this script locate the .msg based on the "Username"
field on the form.

Any help would be greatly appriciated!

Thank you!

Jan 24 '06 #1
3 1827
Ted
What kind of a file would you be searching through?
Access can read the body of an email (or even just the subject) and
extract the data it needs from it to perform the actions you talk
about.
You can also read in text files, Word documents, etc., so the answer to
you question would depend on which format the data is coming to you,
then we can determine what to do with it.
Ted

Jan 24 '06 #2
Ted,

I would like to read the body of an Outlook E-mail.

Something like this (though I am not sure how well this will work)

USERNAME: MIKE SMITH
SUSPENSION DATE: 12-23-05
view

When the user clicks on "view", it will open the sent e-mail.

Jan 24 '06 #3
Ted
Here is what I do when I want Access to read emails, extract the data,
and then perform tasks based on what I find in that data:
Import the selected emails (based on the subject line or you can select
the email based on the sender) into a database table.
I use a memo field to hold the body of the email.
Even though you cannot see them each line in the body ends with the
Chr(13) for Carriage Return and/or Chr(10) for Line Feed.
I check the length of the memo field and assigned it to a variable
field.
I then use the variables to determine the start and end positions of
each new line.
I check the line using the InStr function to determine if a particular
key word or phrase is in that line, such as "USERNAME:"
If it exists, then I take the first position of the term USERNAME and
store the value in a variable.
I then run a loop to look for the end of that line by finding the next
Chr(13) and storing that position number in a variable.
I then use the Mid string function to extract the data from that line.
Here is an example:
Assuming the Chr(13) is at position 80 and the memo field is called
txtBody:
i = 1

If InStr(i, txtBody, "USERNAME:") > 0 Then
intStart = InStr(1, txtBody, "USERNAME:") 'determines what
position USERNAME: starts at
x = intStart
While Not Mid(txtBody, x, 1)
x = x + 1
Wend
intEnd = x
strValue = Mid(txtBody, intStart + 10, intEnd)
End If
i = intEnd + 1

I keep track of the last position and the new starting position using
the i variable and copy the previous section of code and modify it to
look for the next key word I need. I also increment the size of the key
word to match the length of the key word in the line strValue =
Mid(txtBody, intStart + 10, intEnd).

I hope this makes sense. If not I will try to be more specific if you
email me one of the emails you use.

Ted

Jan 24 '06 #4

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

Similar topics

0
by: JF Potvin | last post by:
Hi ! I'm new to Perl and this group so any help is welcome. I've look around the groups a lot but I can't seems to find what I need. I have to do a script that connects to a specific web page...
5
by: Abby Lee | last post by:
My code does what I want (works unless there is a lot of volume...works for this month cause not a lot of items marked paid yet...) but the page times out for last month because there is just so...
0
by: Mishu | last post by:
I have a document log as Access 2000 database. Each record has a corresponding pdf and txt file stored in the same folder as the database. There is a hyperlink field that points to the...
1
by: Edwin Parker | last post by:
I'm fairly new to C, but have most of the basics covered. I have a file that my program writes to, but I need a way to search for information within that file and then edit that information or...
60
by: Julie | last post by:
What is the *fastest* way in .NET to search large on-disk text files (100+ MB) for a given string. The files are unindexed and unsorted, and for the purposes of my immediate requirements, can't...
32
by: tshad | last post by:
Can you do a search for more that one string in another string? Something like: someString.IndexOf("something1","something2","something3",0) or would you have to do something like: if...
0
by: EC | last post by:
There are times when I use the Search utility of windows explorer to find ASPX file(s) that contains a specific word. The Search utility however skips the <script ..> </script> block in the ASPX...
1
by: Rachelle | last post by:
I'm having some trouble with the search field that i am setting up using PHP and HTML, I am connecting to a database to return proper information pertaining to something being searched. I...
3
by: Chung Leong | last post by:
Here's the rest of the tutorial I started earlier: Aside from text within a document, Indexing Service let you search on meta information stored in the files. For example, MusicArtist and...
1
by: nganglove | last post by:
C++ string search -------------------------------------------------------------------------------- Hello, please can any one help me? I am given an assigment in C++ to read a text file and...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

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.