title: Sending an Outlook appointment from Access using VBA
body: <p>I send emails to engineers. I am trying to get Access to set a reminder in their Outlook calendar.</p>
  
  <p>I found from  <a href="https://access-programmers.co.uk/forums/showthread.php?t=209552" rel="nofollow noreferrer">https://access-programmers.co.uk/forums/showthread.php?t=209552</a> something that looked correct. I cut out the code which I didn't require and this is what is left.</p>
  
  <pre><code>Option Compare Database
  
  Sub Outlook()
  Dim obj0App As Object
  Dim objAppt As Object
  Set obj0App = CreateObject("outlook.Application")
  Set objAppt = obj0App.CreateItem(olAppointmentItem)
  
  With objAppt
  .requiredattendees = EmailAddy.Value
  .optionalattendees = ASMail.Value
  .subject = "Training booked for " &amp; " " &amp; QualificationEmail.Value
  .Importance = 2 ' high
  .Start = STdate.Value &amp; "Starting at" &amp; " " &amp; StTime.Value
  .End = Edate.Value
  .Location = Location.Value
  .Reminderminutesbeforestart = 20160 'reminder set for two weeks     before     the event
  .Body = "Training for" &amp; " " &amp; [QualificationEmail] &amp; "." &amp; vbNewLine &amp;     "Any changes to this arrangement will be emailed to you. You will     recieve any confirmation for bookings nearer the time."
  .Meetingstatus = 1
  .responserequested = True
  .Save
  .display
  .send
  MsgBox "Appointment sent"
  End With
  
  End Sub
  </code></pre>
  
  <p>When I test the code .requiredattendee is causing a </p>
  
  <blockquote>
    <p>run-time error 424 Object Required. </p>
  </blockquote>
  
  <p>Why is VBA not recognising required, and optional attendees?</p>
  
  <p>Note:<br>
  The parts which are declaring values which are; EmailAddy, ASMail, QualificationsEmail, STdate, StTime, Edate &amp; Location all link to an Access database form, using Dlookup's on text boxes like the examples below.</p>
  
  <pre><code>=DLookUp("[Engineer Email]","[EngTrainForm]","'[Windows ID]=" &amp; [Windoze] &amp;     "'")
  =[Forms]![Training_Admin]![Windows ID]
  =DLookUp("[Area Of Work]","[EngTrainForm]","'[Windows ID]=" &amp; [Windoze] &amp;     "'")
  =DLookUp("[ASM Email]","[EngTrainForm]","'[Area]=" &amp; [Area] &amp; "'")
  =DLookUp("[OutlookMSG]![Qualification]","[OutlookMSG]","' [EngTrain]!    [Training Date Booked] =" &amp; [EngDate] &amp; "'")
  </code></pre>
  
  <p>When I step through, the olAppointmentItem = Empty and the code halts at <code>.requiredattendees = EmailAddy.Value</code> bringing up</p>
  
  <blockquote>
    <p>Run-Time error 424, Object required.</p>
  </blockquote>
  
  <p>If I add an <code>on error resume next</code>, and run through the code I get an email message with the Importance working as the Body details (accept the qualificationEmail).</p>
  
  <p>The <code>.requiredattendees = EmailAddy.Value</code> on the watch list is saying that the Expression is not defined in context, and the context is OutlookCalander,Outlook.</p>