Hello Ken,
Thanks for replying!
Okay, I have a table called xxx which is created in an Access database
called LS. This table contains a field that does not exist in the contact
items of MS Outlook. The field is called "TBK_Comment". I would like to
import all the fields from this table including the TBK_Comment field. I
really don't need more that this, except that in the future I my require to
bring over several fields instead of one field.
So basically now, if I import the table from Access into MS Outook, I am
able to import all the fields except the one that does not exist in Outlook.
So my question to you is, If I use the snippet of code you suppiled:
==========================================
Dim oProp As Outlook.UserProperty
Set oProp = oContact.UserProperties("TBK_Comment")
If (oProp Is Nothing) Then
Set oProp = oContact.UserProperties.Add("TBK_Comment", olText, True)
End If
oProp.Value = oRST.Fields("TBK_Comment")
oContact.Save
============================================
will this import the TBK_Comment field only? Suppose I would like to import
all the fields including the TBK_Comment field?
Also, does this snippet of code have to be inserted in a VBA macro?
at ToolsMacroMacros ?
Thanks for your help!
--
Best regards
Roberto
"Ken Slovak - [MVP - Outlook]" wrote:
Well, it's hard to even supply a code snippet without know more about what
you want. For example is this for contact items or task or appointment items
or what? Is this for every item in a folder or selected items? Be more
detailed in describing your requirements.
At a very basic level assuming you have a macro (VBA Outlook Sub) that has a
ContactItem called oContact and you have an ADO recordset with the field you
want, one named "Foobar" that's a text field and you want to add that
property from the recordset to the oContact item, that would look like this:
' oRST is an ADOB.Recordset already instantiated and filled
Dim oProp As Outlook.UserProperty
Set oProp = oContact.UserProperties("Foobar")
If (oProp Is Nothing) Then
Set oProp = oContact.UserProperties.Add("Foobar", olText, True)
End If
oProp.Value = oRST.Fields("Foobar")
oContact.Save
Of course a DAO recordset would be slightly different, and that snippet
doesn't cover selecting the items to update, getting the recordset and so
on.
--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm
"Robby" wrote in message
...
hello Ken,
I used to do alot of VBA.... 4 years ago. Unfortunately, its sort of
forgotten!
I simply need to map and import a new field from my Access tables. I was
hoping for a one or two line snippet sample of code in VBA coded in a
macro.
From the little that I remember about VBA, I am sure it isn't that
complicated.
In one post a felow said to use:
MailItem.UserProperties
But how, what procedures.... do I create a macro in outlook and so forth
?
The only reason I wanted to do this is so I can bring in a feild from
Access
to Outlook and then allow synchronization with a Blackberry.
If anyone can gracefully post a simple sample that allows Outlook to
import
a new field, I would really appreciate it. 
--
Best regards
Roberto