Link to home
Start Free TrialLog in
Avatar of baggsh
baggsh

asked on

Access2000 to Outlook2000 folders

I am attempting to send data from an Access Application to a subfolder in Contacts. How do I address a subfolder which is under the Contacts folder. Ie I have three types of contacts, Banks, Agents and Councils. Each has its own subfolder in Outlook under Contacts. Every attempt to write to these subfolders have all resulted in all data ending up in the main Contacts folder. I am suspicios this connot be done. If so is there another way. Can I send data from Access to a folder on the same level as Contacts without having to make it the default contacts folder?I do not want to enter Outlook, change the defauly folder everytime I need to send data from my Access Application. I am not using the exchange Server..just Windows98

Avatar of celtics
celtics

You are not going to like it but here is an article from Microsoft stating that by contacts are automatically placed in the default contacts folder : http://support.microsoft.com/support/kb/articles/Q208/2/32.ASP
Avatar of baggsh

ASKER

Then is there progamatically a way of changing the default folder , writing the data, then changing back the default folder to the original folder?
Celtics is only partially correct, using the standard import/export routine you can only import to the default Contacts folder.

But, you can do what you describe using VB. Please post the VB code you are presently using to post from Access to Outlook.

Thanks,
Jhana
If you are using the standard contact item, then the following code should be approximately what you need to add contacts to your subfolders.

' Default Contacts Folder
Set DContacts = Application.GetNameSpace("MAPI").GetDefaultFolder(10)

' Banks Subfolder under contacts
Set BanksFld = DContacts.Folders("Banks")

' Add item to subfolder
Set AddBank = BankFld.Add("IPM.Contact")
Avatar of baggsh

ASKER

JHana

here's the code as presently exists which writes to Contacts as the default folder. What we really need is to be able to write to Banks (say) as the subfolder of Contacts.

Dim out As Outlook.Application
 Dim calTask As Outlook.ContactItem
 
 Set out = New Outlook.Application
 Set calTask = out.CreateItem(olContactItem)

 With calTask
 
   .CompanyName = Me!Name
   .BusinessAddressStreet = Me!Street
   .BusinessAddressCity = Me!City
 
   If IsNull(Me!Phone) Then
    .BusinessTelephoneNumber = " "
   Else
   .BusinessTelephoneNumber = Me!Phone
   End If
   If IsNull(Me!Fax) Then
     .BusinessFaxNumber = " "
   Else
   .BusinessFaxNumber = Me!Fax
   End If
   If IsNull(Me!Email) Then
    .Email1Address = " "
    Else
    .Email1Address = Me!Email
    End If
    .NickName = Me!Sal
   .Save
  End With


I would be very pleased to receive any comments from anyone who can do this!!!

ASKER CERTIFIED SOLUTION
Avatar of jhana
jhana

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of baggsh

ASKER

Where exactly is the reference to Contacts\Bank ie where do I insert the three seperate subfolders that I have (Banks, Conveyancers or Councils?)
So sorry, I forgot to change the name, it is the second line... just substitute the name of your subfolder for "Sound". The first line references the "Contacts" folder.

"Contacts" folder
  Set pFolder = nms.GetDefaultFolder olFolderContacts)
 Set plFolder = pFolder.Folders("Sound")

Good luck,
Jhana
Avatar of baggsh

ASKER

Thankyou for your wonderful help. I have it now all working. I am going to post another question about Exchange Servers....maybe you can help me with that. I use win98 and by sharing the pst file has certain drawbacks on a small office network (4 computers). I wonder what my next step will be. How can I address this question for you so that you get the points!
Points aren't the point ;-) it's helping someone solve a problem :-) Just post your question and I'm sure one of EE's experts will be able to help.

Thanks,
Jhana