Hi, I'm a complete novice at VBA and coding in general. I've only made a few simple databases.
I am using Outlook 2010 and Access 2010. The calendar is Microsoft exchange.
I was hoping that I could have one of my databases add appointments to outlook or at least open outlook and have the appointment up with the date/time/address filled in?
I had a look around and found this code below that seems to be what I need. I tried it by adding it as an event procedure to a button on a form and edited it to fit my fields. However when I click on the button it comes back with:
"Compile error: user-defined type not defined" and it highlights the first line. Am I being really daft and gone about this the wrong way or do I need to edit the code??
Any advice would be appreciated!
I am using Outlook 2010 and Access 2010. The calendar is Microsoft exchange.
I was hoping that I could have one of my databases add appointments to outlook or at least open outlook and have the appointment up with the date/time/address filled in?
I had a look around and found this code below that seems to be what I need. I tried it by adding it as an event procedure to a button on a form and edited it to fit my fields. However when I click on the button it comes back with:
"Compile error: user-defined type not defined" and it highlights the first line. Am I being really daft and gone about this the wrong way or do I need to edit the code??
Any advice would be appreciated!
Code:
Private Sub AddtoOutlook_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.[Date of Training]
.Duration = Me.[Duration]
.Subject = Me.[Type of Training]
.Save
End With
Set outobj = Nothing
DoCmd.RunCommand acCmdSaveRecord
MsgBox "Appointment Added!"
Exit Sub
End Sub