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

Import outlook custom form fields data into access

KS
Hi,

I have creatd a custom Outlook form with a few custom form fields.
When completed the form is sent to me and goes into my Inbox. This
works fine. Now Iam trying to write some code in Access to import
l;oop though my inbox and pick up all the usesr defined field data
from any messages froma specific subject. I have have mixed and
matched some code I found on the net however it doesn't seem to work
properly. problems I face are:

1. I have published this form in my firms org library however when the
code finds this msg (with the subject stated in the code) it still
prompts me to enable/disable macros. I can open this up directly from
outlook and not get the msg. Am not sure why this happens?

2. The code does work up to the extent that it will only pick up the
specific msg with the subject stated however it does not import the
users defined field data. I have made sure the field name stated does
indeed match etc. However still now joy. I can seem to figure out
why this is?

3. I now also however want to change it so that the code looks to
search a personal folder instead of my inbox. I will get hundreds of
responses which I want to set up a rule to filter to a persoanl folder
from there I want to run the code at the end of the week to pick up
all the data...without the macro warning!

The code i am using now is as below:

Sub ImportDataFromOutlook()
Dim rst As DAO.Recordset
Set rst = CurrentDb.OpenRecordset("results")
Dim Ol As New Outlook.Application
Dim olns As Outlook.Namespace
Dim cf As Outlook.MAPIFolder
Dim c As Outlook.MailItem
Dim objItems As Outlook.Items
Dim Prop As Outlook.UserProperty
Dim inumreplies As Integer
Dim countitems As Integer
DoCmd.SetWarnings False
Set olns = Ol.GetNamespace("MAPI")
Set cf = olns.GetDefaultFolder(olFolderInbox)
Set objItems = cf.Items
inumreplies = objItems.Count
countitems = 0
If inumreplies <> 0 Then
For i = 1 To inumreplies
If TypeName(objItems(i)) = "mailitem" Or objItems(i) = "MI
Group - Customer Satisfaction Survey" Then
countitems = countitems + 1
Set c = objItems(i)
rst.AddNew
rst!part1a = c.UserProperties("MIQ1")
rst!Date = Now
rst.Update
End If
Next i
rst.Close
DoCmd.SetWarnings True
MsgBox "Finished. " & countitems & " Mails imported from " & i -
1 & " mails in inbox"
Else
MsgBox "No Mails to import."
End If
End Sub
Any help and advise on this would be greatly appriciated!

Regards

Kunal
Nov 13 '05 #1
1 8190
Hi Kunal

1. If your code were written in Outlook, you could use the program
Selfcert.exe (which is on the Office 2000 and 2002 CDs) to certify
your code. This would prevent the Enable/Disable prompt from
appearing.

Even with the "Enable/Disable" prompt disabled, the latest Outlook
security patches may still intervene with a different prompt, saying
"A program is trying to do something with Outlook. Do you want to
allow this?" And you will have to wait 10 seconds before you can
reply "Yes, allow this for, say, 10 minutes."

There is a way round this second security issue. You will have to get
hold of the Redemption Library and rewrite your code appropriately.
You'd create a reference to the library first (in the vba editor on
the Tools References menu). The Redemption Library is available from
http://www.dimastr.com/redemption/ For more information on how to
use the library, you might want to get hold of Sue Mosher's book
"Microsoft Outlook Programming - Jumpstart for Administrators,
Developers and Power Users" and visit her web site www.slipstick.com.

2. You're using "UserProperties" to extract the data from the
Outlook form attached to the mail. Sorry, I can't help with this.

3. To point to a different folder - Each Outlook folder has a
folders collection. So, if you had a subfolder in your InBox called
"My Survey Folder", you could point to it by extending your code:

Set cf = olns.GetDefaultFolder(olFolderInbox)
Set objMySurveyFolder = cf.Folders.Item("My Survey Folder")

Also the Namespace.PickFolder method allows you to select a folder at
runtime.

(Again, good examples of all this in Sue's book.)

Good luck.
Geoff


Nov 13 '05 #2

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

Similar topics

3
by: Jon Ole Hedne | last post by:
My Access 2002-application need to work with tables from both Oracle and Access. To solve this, I want to run some querys on three views in Oracle and import the results into temporary...
22
by: James Cane | last post by:
Here's an interesting problem that someone might have an answer to... Some time ago, I wrote a set of utility classes which wrap up the custom row source function needed to add arbitrary items to...
2
by: sfriedman | last post by:
I was able to successfully link my Outlook Contacts table to an Access Database and create an entry form. Unfortunately the Displayname field which is one of the key fields for how the contact is...
1
by: David Berry | last post by:
Hi All. I'm looking for any help or sample code that can show me how to make a file import wizard in ASP.NET (VB preferred) like the one that MS Access uses. I'm working on a web site where the...
1
by: Mr T | last post by:
I know how to send email from Access and I know how to create a custom form in Outlook. but.... How do I put the email info from Access into the Outlook custom form ??? Dim MyDB As Database Dim...
0
by: RLN | last post by:
Hello. Re: Access 2003 / Outlook 2003 I would like to do some bulk modifications to the following fields on these default forms in Outlook for a specific .pst file in...
6
by: Kevin | last post by:
In my business, I use Quickbooks extensively for billing and accounting and a custom built Access DB for project management. I recently began using MS Outlooks contacts quite extensively as well...
2
hyperpau
by: hyperpau | last post by:
Before anything else, I am not a very technical expert when it comes to VBA coding. I learned most of what I know by the excellent Access/VBA forum from bytes.com (formerly thescripts.com). Ergo, I...
0
hyperpau
by: hyperpau | last post by:
Before anything else, I am not a very technical expert when it comes to VBA coding. I learned most of what I know by the excellent Access/VBA forum from bytes.com (formerly thescripts.com). Ergo, I...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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
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
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.