Movian
05-14-2009, 11:16 AM
Hi,
i have been trying to setup a good way to use the outlook calendar to organize scheduling for a medical clinic from our Access database.
currently the system will be able to add an apointment. However when the apointment window comes up you can't do much with it. It seems that by opening that apointment window in code you lock most other outlook functions. So you cant look at the calendar to find a good spot to schedule.
Here is what i have at the moment
~edit~ realized this sub was opening a dao table connection when it didn't need to so have removed it
Private Sub Command0_Click()
CreateApointment Me.Text4.Value & ", " & Me.Text3.Value & " - " & Me.Procedure, "Home:" & Me.Text10.Value & " - Cell: " _
& Me.Cell & " - DayTime: " & Me.DayTime, "Medical ID" & vbNewLine & Me.Text1.Value & vbNewLine & vbNewLine & "Address" _
& vbNewLine & Me.Text6.Value & vbNewLine & Me.Text7.Value & ", " & Me.Text8.Value & " " & Me.Text9.Value & vbNewLine _
& vbNewLine & "Comment:" & vbNewLine & Me.Text32
End Sub
Public Sub CreateApointment(subj As String, Location As String, Body As String)
Dim olapp As Object ' Outlook.Application
Dim olapt As Object ' olAppointmentItem
Dim flag As Boolean
flag = False
On Error GoTo makenew:
Set olapp = GetObject(, "Outlook.Application")
On Error Resume Next
If flag = False Then
Set olapt = olapp.CreateItem(1) ' olAppointmentItem = 1
With olapt
.Start = Date + 1 + TimeValue("19:00:00")
.End = .Start + TimeValue("00:30:00")
.Subject = subj
.Location = Location
.Body = Body
.ReminderMinutesBeforeStart = 120
.ReminderSet = True
.Display True
End With
End If
makenew:
If Err.Number = 429 Then
Set olapp = CreateObject("Outlook.Application")
Set olapt = olapp.CreateItem(1) ' olAppointmentItem = 1
With olapt
.Start = Date + 1 + TimeValue("19:00:00")
.End = .Start + TimeValue("00:30:00")
.Subject = subj
.Location = Location
.Body = Body
.ReminderMinutesBeforeStart = 120
.ReminderSet = True
.Display True
End With
flag = True
End If
Resume Next
End Sub
What i would ideally like to do is have it so when i click the button (first section of code) instead of bringing up a new apointment window. It would instead bring up the users calendar view then when they double click in a calendar (our clients typically want to use multiple calendars) when it brings up that apointment window from the double click it would THEN populate that window with the information.
I am unsure if this is possible and if it is i have NO idea how to go about it. I look around for months for information on seting up a calendar system in access and everything i found wasn't realy what we were after. Thats why we decided to try and use the oulook calendar as it apears to offer everything we need. However while automation with most other office products (word, exell) seem easy and straight forward. it looks like the outlook automation was designed by a blind monkey :\
no offence if anyone here was involved in that : pray2:
But as always any help is apriciated!
i have been trying to setup a good way to use the outlook calendar to organize scheduling for a medical clinic from our Access database.
currently the system will be able to add an apointment. However when the apointment window comes up you can't do much with it. It seems that by opening that apointment window in code you lock most other outlook functions. So you cant look at the calendar to find a good spot to schedule.
Here is what i have at the moment
~edit~ realized this sub was opening a dao table connection when it didn't need to so have removed it
Private Sub Command0_Click()
CreateApointment Me.Text4.Value & ", " & Me.Text3.Value & " - " & Me.Procedure, "Home:" & Me.Text10.Value & " - Cell: " _
& Me.Cell & " - DayTime: " & Me.DayTime, "Medical ID" & vbNewLine & Me.Text1.Value & vbNewLine & vbNewLine & "Address" _
& vbNewLine & Me.Text6.Value & vbNewLine & Me.Text7.Value & ", " & Me.Text8.Value & " " & Me.Text9.Value & vbNewLine _
& vbNewLine & "Comment:" & vbNewLine & Me.Text32
End Sub
Public Sub CreateApointment(subj As String, Location As String, Body As String)
Dim olapp As Object ' Outlook.Application
Dim olapt As Object ' olAppointmentItem
Dim flag As Boolean
flag = False
On Error GoTo makenew:
Set olapp = GetObject(, "Outlook.Application")
On Error Resume Next
If flag = False Then
Set olapt = olapp.CreateItem(1) ' olAppointmentItem = 1
With olapt
.Start = Date + 1 + TimeValue("19:00:00")
.End = .Start + TimeValue("00:30:00")
.Subject = subj
.Location = Location
.Body = Body
.ReminderMinutesBeforeStart = 120
.ReminderSet = True
.Display True
End With
End If
makenew:
If Err.Number = 429 Then
Set olapp = CreateObject("Outlook.Application")
Set olapt = olapp.CreateItem(1) ' olAppointmentItem = 1
With olapt
.Start = Date + 1 + TimeValue("19:00:00")
.End = .Start + TimeValue("00:30:00")
.Subject = subj
.Location = Location
.Body = Body
.ReminderMinutesBeforeStart = 120
.ReminderSet = True
.Display True
End With
flag = True
End If
Resume Next
End Sub
What i would ideally like to do is have it so when i click the button (first section of code) instead of bringing up a new apointment window. It would instead bring up the users calendar view then when they double click in a calendar (our clients typically want to use multiple calendars) when it brings up that apointment window from the double click it would THEN populate that window with the information.
I am unsure if this is possible and if it is i have NO idea how to go about it. I look around for months for information on seting up a calendar system in access and everything i found wasn't realy what we were after. Thats why we decided to try and use the oulook calendar as it apears to offer everything we need. However while automation with most other office products (word, exell) seem easy and straight forward. it looks like the outlook automation was designed by a blind monkey :\
no offence if anyone here was involved in that : pray2:
But as always any help is apriciated!