473,748 Members | 10,889 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 ImportDataFromO utlook()
Dim rst As DAO.Recordset
Set rst = CurrentDb.OpenR ecordset("resul ts")
Dim Ol As New Outlook.Applica tion
Dim olns As Outlook.Namespa ce
Dim cf As Outlook.MAPIFol der
Dim c As Outlook.MailIte m
Dim objItems As Outlook.Items
Dim Prop As Outlook.UserPro perty
Dim inumreplies As Integer
Dim countitems As Integer
DoCmd.SetWarnin gs False
Set olns = Ol.GetNamespace ("MAPI")
Set cf = olns.GetDefault Folder(olFolder Inbox)
Set objItems = cf.Items
inumreplies = objItems.Count
countitems = 0
If inumreplies <> 0 Then
For i = 1 To inumreplies
If TypeName(objIte ms(i)) = "mailitem" Or objItems(i) = "MI
Group - Customer Satisfaction Survey" Then
countitems = countitems + 1
Set c = objItems(i)
rst.AddNew
rst!part1a = c.UserPropertie s("MIQ1")
rst!Date = Now
rst.Update
End If
Next i
rst.Close
DoCmd.SetWarnin gs 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 8228
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.GetDefault Folder(olFolder Inbox)
Set objMySurveyFold er = cf.Folders.Item ("My Survey Folder")

Also the Namespace.PickF older 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
23457
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 Access-tables. I have tried this: conn.Provider = "Microsoft.Jet.OLEDB.4.0" conn.ConnectionString = "data source=" & datafil & ";Jet OLEDB:Database Password=" conn.Open datafil
22
6130
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 a combo or listbox. It all works nicely and allows me to do things such as sorting by clicking on column headings. Recently, all the machines here were upgraded to Access XP from 97 and I thought it might be time to take advantage of the new...
2
2298
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 stored states that it is an expression and will not accept entry, nor will it automatically conjoin the first and last names as it would normally do if you entered it in an outlook form. Without this when you click on the entry in outlook instead...
1
4025
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 user has the ability to upload a file (.txt or .csv). The data in the file may be comma delaminated, tab delaminated, fixed width etc (we don't know). What I'd like to create is something like MS Access uses to import an Excel file into the...
1
5956
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 MyRS As Recordset Dim objOutlook As Outlook.Application Dim objOutlookMsg As Outlook.MailItem Dim objOutlookRecip As Outlook.Recipient Dim objOutlookAttach As Outlook.Attachment
0
1287
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 C:\MyFolder\MyOutlookStuff.pst : -Remove parentheses on the phone numbers in the "Home Phone", Business Phone" and "Mobile Phone" fields on the "General" form tab. -Modify "Category" & "Notes" on the "General" form tab -Modify "Profession" on the "Details" form tab
6
2657
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 (recently bought a PDA to bring to job sites!). I have been able to get things set up so that I can synchronize my Quickbooks customer and vendor lists with the Outlook contacts, and thus with my PDA and this has been immensely helpful. My DB has...
2
19484
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 will be writing this article intended for those who are in the same level, or maybe lower, of my technical knowledge. I would be using layman's words, or maybe, my own words as how I understand them, hoping, you will understand it the same way that...
0
2897
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 will be writing this article intended for those who are in the same level, or maybe lower, of my technical knowledge. I would be using layman's words, or maybe, my own words as how I understand them, hoping, you will understand it the same way that...
0
8830
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,...
0
9370
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 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...
1
9321
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,...
0
8242
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, 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...
1
6796
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 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...
0
6074
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();...
0
4602
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...
0
4874
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3312
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.