Save as outlook contact (saveasoutlookcontact) (1 Viewer)

JeffreyCarlino

New member
Local time
Yesterday, 21:09
Joined
Aug 24, 2011
Messages
2
To all,

I having trouble with the built in macro function "saveasoutlookcontact", I copied a button from the Northwind sample database customer information form, but when i click the button not all of the information migrates over to outlook. Can anyone shed light on why this will not work.
 

mistyinca1970

Member
Local time
Yesterday, 18:09
Joined
Mar 17, 2021
Messages
117
I see this is an old thread, but I am having the same problem as well. When I use this macro, the first name, last name, title, and email transfers over, but the phone numbers do not. I have renamed my fields to make sure that they match the ones in the database template, and they still do not transfer over. Any ideas?
 

NauticalGent

Ignore List Poster Boy
Local time
Yesterday, 21:09
Joined
Apr 27, 2015
Messages
6,328
I normally do not use Macros because there is too much out of my control. Give this thread a look over to see if it might be of some help.

You could convert the Macro to VBA and see EXACTLY how it is working with your table and then trouble shoot as necessary.
 

Samantha

still learning...
Local time
Yesterday, 21:09
Joined
Jul 12, 2012
Messages
180
I normally do not use Macros because there is too much out of my control. Give this thread a look over to see if it might be of some help.

You could convert the Macro to VBA and see EXACTLY how it is working with your table and then trouble shoot as necessary.

I see this is an old thread, but I am having the same problem as well. When I use this macro, the first name, last name, title, and email transfers over, but the phone numbers do not. I have renamed my fields to make sure that they match the ones in the database template, and they still do not transfer over. Any ideas?
I could never get the northwind template to work either. Here is the code I use, good luck. I prefix the fax number with the word fax so it doesn't pop up in the address book as an available option.

Code:
Private Sub cmdSaveToOutlook_Click()
    On Error GoTo Error_Handler
    Const olContactItem = 2
    Dim olapp As Object, olContact As Object
    Dim Ctct As Object, BFax As String
    
    Set olapp = CreateObject("Outlook.Application")
    Set olContact = olapp.CreateItem(olContactItem)

'pre-fix fax number with "fax" so it doesn't pop up in the address book 
  If IsNull(Me.Business_Fax) Then
    BFax = ""
    Else: BFax = ("Fax " & Me.Business_Fax)
    End If
    
    With olContact
        .FirstName = Nz(Me.First, "")
        .LastName = Nz(Me.Last, "")
        .JobTitle = Nz(Me.Job_Title, "")
        .CompanyName = Nz(Me.CompanyName, "")
        .BusinessAddressStreet = Nz(Me.MailingAddress, "")
        .BusinessAddressCity = Nz(Me.City, "")
        .BusinessAddressState = Nz(Me.State, "")
        .BusinessAddressCountry = "USA"
        .BusinessAddressPostalCode = Nz(Me.Zip_Postal_Code, "")
        .BusinessTelephoneNumber = Nz(Me.Phone, "")
        .BusinessFaxNumber = BFax
        .Email1Address = Nz(Me.E_mail_address, "")
        .Email1DisplayName = Nz(Me.DisplayAs, "")
        .MobileTelephoneNumber = Nz(Me.Mobile_Phone, "")
        .Display 'use .Display if you wish the user to see the contact pop-up .Save to save
    End With
 
Error_Handler_Exit:
    On Error Resume Next
    Set olContact = Nothing
    Set olapp = Nothing
    End
    
Error_Handler:
    MsgBox "MS Access has generated the following error" & vbCrLf & vbCrLf & "Error Number: " & _
    Err.Number & vbCrLf & "Error Source: AddOlContact" & vbCrLf & "Error Description: " & _
    Err.Description, vbCritical, "An Error has Occured!"
    Resume Error_Handler_Exit
End Sub
 

mistyinca1970

Member
Local time
Yesterday, 18:09
Joined
Mar 17, 2021
Messages
117
Trying to reply...

Apparently I can't quote without getting this message "Your content can not be submitted. This is likely because your content is spam-like or contains inappropriate elements. Please change your content or try again later. If you still have problems, please contact an administrator."

Anyway regarding converting to vb, I tried that in a copy of the form and it was still a single command function without separate arguments.
 

Users who are viewing this thread

Top Bottom