UtterAccess.com
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    
 
   
TimTDP
post Jun 19 2018, 10:01 AM
Post#1



Posts: 1,041
Joined: 16-June 05



I have found the following code to set an appointment in Outlook from access. Author unknown but thank you
CODE
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
        
               .Save
            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
 
theDBguy
post Jun 19 2018, 10:12 AM
Post#2


Access Wiki and Forums Moderator
Posts: 72,726
Joined: 19-June 07
From: SunnySandyEggo


Hi,

Try:

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

or maybe just leave it out.

Hope it helps...

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Access Website | Access Blog | Email
Go to the top of the page
 
TimTDP
post Jun 20 2018, 02:50 AM
Post#3



Posts: 1,041
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    17th July 2018 - 10:13 PM