Importing MS Outlook Contacts from a MSAcess Data Base

SergioRocha

Registered User.
Local time
Today, 06:06
Joined
Dec 7, 2008
Messages
15
I need to get information from a MSAccess DB that i've made.
I have 2 forms. The main form has the following fields: Foto, Name and Birthday. The subform has the following fields: address, mobile phone, email.
I want to store into the field Mobile_Phone the information of Tlm (this is the field from the subform Contactos inserted in the Main Form).
I wrote the following code:

Dim olns As Object ' Outlook Namespace.
Dim cf As Object ' Contact folder.
Dim c As Object ' Contact item.
Dim ol As New Outlook.Application
Set olns = ol.GetNamespace("MAPI")
Set cf = olns.GetDefaultFolder(olFolderContacts)

' Create a new Contact item.
Set c = ol.CreateItem(olContactItem)
' Specify which Outlook form to use.
c.MessageClass = "IPM.Contact"
c.FullName = Me.Nome -> this line works OK
c.Mobile_Phone = Contactos!Tlm -> this one does't work

What seems to be the problem?It has something to do with field types? Where can i get that information? Please help me!
 
c.Mobile_Phone = Contactos!Tlm -> this one does't work
Have you tried:
c.Mobile_Phone = Me!Tlm
 
Yes, i've tried that too... but it didn't work. I receive the same error message:
"Microsoft Access can't find the field 'Tlm' "... i don't know what to do :confused:
 
Are you trying to copy a control value from your current form to a Field in the table?
 
Let me try to explain this...
I have 2 tables: Dados_pessoais and Contactos.
Dados_pessoais has the following fields: Foto, Name, Surname...
Contactos has the following fields: email, phone, mobile_phone, address...
I've 2 forms (Main and Contactos). Main form gets the data from table Dados_pessoais and form Contactos gets the data from table Contactos. I've inserted form Contactos on Main form. I want to click a button and create an Outlook contact that get the information from some fields in form Main and other from subform Contactos.:o
 
Woooowww... nice information!Thank you :). Well i've tried this:
Me!Contactos.Form.Tlm -> with this line i can get the data from de field Tlm from the subform Contactos. I've test it with this:

str = Me!Contactos.Form.Tlm
MsgBox str
but... when i try this:

c.Mobile_Phone = Me!Contactos.Form.Tlm

i get the following error message:
Object doesn't support this property or method.

What seams to be the problem? :o:o:o
 
It sounds to me like it does not like c.Mobile_Phone
 
Excellent! Thanks for posting back with your success.
 

Users who are viewing this thread

Back
Top Bottom