Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Microsoft Access 2000 Automatic Population

Status
Not open for further replies.

FTM37

IS-IT--Management
Oct 12, 2002
1
GB
Hi

I hope one of you guys could help me out, I have data regularly e-mailed to me and i have to copy and paste it into my database. Is there a way (with VB perhaps) of automatically once a day having this data input into my database table. If i download it to a certain directory and have the VB script look in this directory?

thanks in advance for any help, this is my first use of a forum!

Cheers

Chris
 
Hi

If the data is in a predifend format, this should not be too difficult.

Do you use Outlook (not Outlook Express) as your mail client?, if yes, from within Access, create an instance of Outlook, read the messages, process them and voila you have it.

You need code similar to the following:

Dim olApp As Outlook.Application
Dim olNS As Outlook.NameSpace
Dim olFolder As Outlook.MAPIFolder
Dim strSubjectLine As String
Dim strFormSubmission As String

Set olApp = GetObject("Outlook.Application")
Set olNS = olApp.GetNamespace("MAPI")
olNS.Logon

Set Db = CurrentDb()
Set Rs = Db.OpenRecordset("SELECT * FROM tblQuestionaire;")
blnMessagesLoaded = False
For i = 1 To olFolder.Items.Count
If olFolder.Items(i).UnRead Then
If olFolder.Items(i).Subject = strSubjectLine Then
If InStr(1, olFolder.Items(i).Body, strFormSubmission) > 0 Then
Rs.AddNew
If DecipherMessage(olFolder.Items(i).Body, Message, Rs) Then
Rs!strSortablePostCode = CreatePostCodeSort(Rs!strPostCode)
Rs.Update
olFolder.Items(i).UnRead = False
blnMessagesLoaded = True
End If
End If
End If
End If
Next i

Please note teh above code is cut from an application I wrote to do something very similar, it is not a working example, just meant to point you in the right direction

Hope this helps
Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
UK
kenneth.reaySPAMNOT@talk21.com
remove SPAMNOT to use
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top