Copying Forms Data Into Outlook

S

StuJol

I have an appointments form in Access2003 which creates an appointment in
outlook 2003, my code is as follows

Private Sub cmdCreateAppt_Click()
On Error GoTo Err_cmdCreateAppt_Click

Dim objOl As Outlook.Application
Dim objItem As Outlook.AppointmentItem
Dim blnOlRunning As Boolean

On Error Resume Next

blnOlRunning = True

Set objOl = GetObject(, "Outlook.Application")

If Err <> 0 Then
Set objOl = CreateObject("Outlook.Application")
blnOlRunning = False
Err.Clear
End If

On Error GoTo 0

Set objItem = objOl.CreateItem(olAppointmentItem)

With objItem
.Start = CDate(Me.txtApptDate) + CDate(Me.txtApptTime)
.Duration = Me.txtDuration * Me.ogDuration
.Location = Me.txtLocation & vbNullString
.Subject = Me.txtSubject & vbNullString
.Body = Me.txtBody & vbNullString

If Len(Me.txtReminder & vbNullString) > 0 Then
.ReminderSet = True
.ReminderMinutesBeforeStart = Me.txtReminder * Me.ogPeriod
Else
.ReminderMinutesBeforeStart = 0
.ReminderSet = False
End If

.Save
End With

If blnOlRunning = True Then
' display the new item
objItem.Display
Else
objOl.Quit
End If



Exit_cmdCreateAppt_Click:
Set objItem = Nothing
Set objOl = Nothing
Exit Sub


Err_cmdCreateAppt_Click:
Select Case Err

Case 0

Case Else
MsgBox Err.Description
Resume Exit_cmdCreateAppt_Click
End Select

End Sub

When i click on create appointment in my form it opens a new appointment
form in outlook, what i want to do is create different labels for various
tasks. When the appointment form opens in outlook, the label field is none.
Does anybody know the code which changes this field?

If so, do you also know how to create new labels
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top