X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
   Reply to this topicStart new topic
> Set Appointment In Outlook From Access, Any Version    
post Jun 19 2018, 10:01 AM

Posts: 1,090
Joined: 16-June 05

I have found the following code to set an appointment in Outlook from access. Author unknown but thank you
Private Sub cmdCreateAppointment_Click()

            Dim outobj As Outlook.Application
            Dim outappt As Outlook.AppointmentItem
            Set outobj = CreateObject("outlook.application")
            Set outappt = outobj.CreateItem(olAppointmentItem)
            With outappt
               .Start = Me.EventStart & " " & Me.time
               .Duration = Me.Duration
               .Subject = Me.Subject
               .Mileage = Me.uniqueID
            End With

         Set outobj = Nothing

         DoCmd.RunCommand acCmdSaveRecord
         MsgBox "Appointment Added!"
      Exit Sub

End Sub

It works well!

My question is:
I don't have the field "Me.time" in the line .Start = Me.EventStart & " " & Me.time
So what would I replace "Me.time" with if I want the appointment time to be at 8am
I have tried .Start = Me.EventStart & " " & "08:00:00" but get a type mismatch error

Thanks in advance
Go to the top of the page
post Jun 19 2018, 10:12 AM

Access Wiki and Forums Moderator
Posts: 75,713
Joined: 19-June 07
From: SunnySandyEggo



.Start = Me.EventStart & " #08:00 am#"

or maybe just leave it out.

Hope it helps...
Go to the top of the page
post Jun 20 2018, 02:50 AM

Posts: 1,090
Joined: 16-June 05

Thanks theDBguy
Same error message unfortunately

If I leave it out appointment is at midnight

What did work:
.Start = Format(Me.NextCommunicationDate, "Short Date") & " " & Format("08:00:00", "Long Time")
This post has been edited by TimTDP: Jun 20 2018, 02:59 AM
Go to the top of the page

Custom Search

RSSSearch   Top   Lo-Fi    18th July 2019 - 03:53 AM