Results 1 to 5 of 5
  1. #1
    Phillipm is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2014
    Posts
    3

    Exclamation Use Access to make an appointment in a Outlook Public folder

    I have been generating an access database to carry out scheduling of maintenance activities. The database will be used by a number of users using different computers which have a combination of Access 2007, 2010 and 2013 like wise they have the same mix for the Microsoft Outlook. I would like the routines generated within Access to be seen/posted on a calendar which is within the Public Folders in Outlook so that they can be seen by all personnel who have an outlook account. I have managed to achieve this direct from my computer but when the database is opened on another computer it does not work as it cannot find the Calendar in question. I have researched the issue and understand that addressing a folder in Outlook 2007 is different to 2010/13 hence I came to the conclusion that I need to use GetFolderFromID rather than drilling down through the folders as is suggested by many when researched on the Web. (I could not get the drill down to work anyway). Whilst sorting out the issue of getting it to work on all computers I have generated a form which writes post a short appointment to allow me to lay with the program without affecting the whole database. The code used is detailed. Does anyone have any idea why this will work every time from one computer but has only worked once or twice on others?



    Code:
    
    Private Sub Command14_Click()
     
        If Me.Dirty Then
            Me.Dirty = False
        End If
     
    '        'Add a new appointment.
     
    ' Use late binding to avoid the "Reference" issue
            Dim olapp As Object ' Outlook.Application
            Dim olappt As Object ' olAppointmentItem
    '       Dim mynamespace As Object
            Dim olfolder1 As Object
           
            If isAppThere("Outlook.Application") = False Then
    ' Outlook not open, create a new instance
                Set olapp = CreateObject("Outlook.Application")
            Else
    ' Outlook open--use this method
                Set olapp = GetObject(, "Outlook.Application")
            End If
     
     
    '    Set mynamespace = olapp.GetNamespace("MAPI")
         Set olfolder1 = olapp.GetNamespace("MAPI")
    'Dim olfolder1 As Outlook.MAPIFolder
        Set olfolder1 = olapp.GetNamespace("Mapi").GetFolderFromID("000000001A447390AA6611CD9BC800AA001297860300BA636AB832B66B4A8E022C4576FGJ1123222891091827300")
      
        Set olappt = olfolder1.Items.Add
     '       Set olappt = olapp.CreateItem(1) ' olAppointmentItem
       
       
        With olappt
     
                ' Set the Start Property Value
                .Start = Nz(Me.startDate, "")
               
                ' Set the End Property Value
                .End = Nz(Me.Enddate, "")
     
     '           .Duration = Nz(Me.txtApptLength, 0)    ' vbNullString uses a little less memory than ""
     '           .Subject = Nz(Me.cboApptDescription, vbNullString)
     
     '           .Body = Nz(Me.txtApptNotes, vbNullString)
                .location = Nz(Me.location, vbNullString) & " " & Nz(Me.Task, vbNullString)
     
                .Save
            End With
    '    End If
     
        ' Release the Outlook object variables.
        Set olfolder1 = Nothing
        Set olappt = Nothing
        Set olapp = Nothing
     
     'Set chkAddedToOutlook to checked
    '    Me.chkAddedToOutlook = True
     
     ' Save the Current Record 
        If Me.Dirty Then
            Me.Dirty = False
        End If
     
     ' Inform the user
        MsgBox "Appointment Added!", vbInformation
    End Sub
    I am confident that the address code for the public folder is correct as I have checked it from other computers so as I understand it the program should work from any computer but as I say it is perfect from the one computer using Access 2010 and Outlook 2010 but not from any of the others though it has worked on the odd occasions which makes the problem even more strange. The address for the public folder/calendar is \\Public Folder\All Public Folders\Maintenance Schedule.

    I have now run out of ideas so would appreciate any help or pointers.

    Regards

    Phillipm
    Last edited by Phillipm; 09-19-2014 at 12:24 AM.

  2. #2
    qa12dx is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    Nov 2012
    Location
    india
    Posts
    112
    not sure if this will help but ....the folder names seem to have spaces in them. don't know if that's a good idea. did a quick google and it says to enclose in "\\Public Folder\All Public Folders\Maintenance Schedule"also, client machines dont need to have access installed in them. MS distributes free runtimes. I know there is Access Runtime for 2007 and i think 2010. So maybe just uninstall Access and distribute the runtime exe

  3. #3
    Phillipm is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2014
    Posts
    3
    When starting the form I went down the path of drilling through the folders by naming each folder so that you step into the list one stage at a time, (this was suggested in many websites). I could not get this right then learnt that 2010 Outlook onwards places the persons email address in the address where as 2007 does not hence the reason for going direct to the folder using the GetFolderFRomID method. This works fine from my computer but as I say does not work from others though on the odd occasion it will achieve a connection and make the appointment. I do not know why this is the case! Using this method I thought I would be able to write the appointment from any computer. I am unable to change what is loaded onto other computers as I do not have that authority so I cannot follow your other suggestion.

    Thanks for replying; any other ideas would be appreciated including away of naming the folders which would work on both outlook 2007 and 2010 the codes that I picked up off the internet did not seem to work due to the need to enter the users email address and I did not know how to do this within the program.

  4. #4
    qa12dx is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    Nov 2012
    Location
    india
    Posts
    112
    look up vb code to map network drive. may give u some more ideas.

    also the codes use a defined drive letter. works for a comp, but accross, someone maybe using that drive letter. loop it 26 times, starting with 'z', if fail 'y', if fail 26 times self destruct

  5. #5
    Phillipm is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2014
    Posts
    3
    [QUOTE=qa12dx;246451]look up vb code to map network drive. may give u some more ideas.

    Thanks for the reply though I am not sure where this would fit into the code or how it would apply, can you clarify?

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 1
    Last Post: 05-31-2013, 02:04 AM
  2. creating folder from Ms access in outlook
    By capitala in forum Programming
    Replies: 5
    Last Post: 03-08-2013, 10:05 PM
  3. Add appointment to public calendar
    By avarusbrightfyre in forum Import/Export Data
    Replies: 4
    Last Post: 02-19-2013, 11:00 AM
  4. issue with linking outlook folder to access
    By live2ride in forum Import/Export Data
    Replies: 7
    Last Post: 12-20-2012, 12:24 PM
  5. Replies: 3
    Last Post: 11-10-2010, 09:52 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums