sorry another numpty question........

philwalker531

Registered User.
Local time
Today, 04:39
Joined
Feb 14, 2010
Messages
22
i current have a database that i have cobbled together from bits of stuff i have found on the internet - and if im really honest i do not understand VB :(

I currently have a button that adds an appointment to outlook.

here is what ive got and it works.


PHP:
Private Sub btnAddApptToOutlook_Click()
 
    ' Save the Current Record
    If Me.Dirty Then
        Me.Dirty = False
    End If
 
    ' Exit the procedure if appointment has been added to Outlook.
    If Me.chkaddedtooutlook = True Then
        MsgBox "This appointment has already added to Microsoft Outlook.", vbCritical
        Exit Sub
 
    Else
        ' Add a new appointment.
        ' Use late binding to avoid the "Reference" issue
        Dim olApp As Object     'Outlook.Application
        Dim olappt As Object    'olAppointmentItem
 
        ' This is how we would do it if we were using "early binding":
        ' Dim outobj As Outlook.Application
        ' Dim outappt As Outlook.AppointmentItem
        ' Set outobj = CreateObject("Outlook.Application")
        ' Set outappt = outobj.CreateItem(olAppointmentItem)
 
        If isAppThere("Outlook.Application") = False Then
            ' Outlook is not open, create a new instance
            Set olApp = CreateObject("Outlook.Application")
        Else
            ' Outlook is already open--use this method
            Set olApp = GetObject(, "Outlook.Application")
        End If
 
        ' Create the New Appointment Item
        Set olappt = olApp.createitem(1) ' olAppointmentItem = 1
 
        ' Add the Form data to the Appointment Properties
        With olappt
           ' If There is no Start Date or Time on
           ' the Form use Nz to avoid an error
 
           ' Set the Start Property Value
           .Start = Nz(Me.Event_date, "") & " " & Nz(Me.Event_time, "")
                                            
            
           .duration = Nz(180, 0)
 
            ' vbNullString uses a little less memory than ""
            .subject = Nz(Me.Venue, "vbnullstring") & " suite " & Nz(Me.Suite, vbNullString) & " REF " & Nz(Me.Reference, vbNullString) & "  " & Nz(Me.Bride, vbNullString)
 
            .body = Nz(Me.Chair_covers, vbNullString) & " " & Nz(Me.Description, vbNullString) & " --------(table linen)-------- " & Nz(Me.Description_2, vbNullString) & " --------- Additional Items ----------- " & Nz(Me.Description3, vbNullString) & "     other info       " & Nz(Me.Other_inf, vbNullString) & "  address  " & Nz(Me.Address_line1, vbNullString) & " " & Nz(Me.Address_line2, vbNullString) & " " & Nz(Me.Town, vbNullString) & " " & Nz(Me.Postcode, vbNullString) & " tel nos " & Nz(Me.Tel_no, vbNullString) & " " & Nz(Me.Alt_tel_no, vbNullString)
            .Location = Nz(Me.Venue, vbNullString) & " " & Nz(Me.Suite, vbNullString)
        
        
        ' Save the Appointment Item Properties
        .Save
        End With
    End If
 
    ' Release the Outlook object variables.
    Set olappt = Nothing
    Set olApp = Nothing
 
    ' Set chkAddedToOutlook to checked
    Me.chkaddedtooutlook = True
 
    ' Save the Current Record because we checked chkAddedToOutlook
    If Me.Dirty Then
        Me.Dirty = False
    End If
 
    ' Inform the user
    MsgBox "Appointment Added!", vbInformation
 
End Sub

i have seen this thread http://www.access-programmers.co.uk/forums/showthread.php?t=168216&page=2 that does what i want it to do but i dont understand which bit does what as it doesn't look like the one i have!?!:confused:

i want to be able to find and delete an appointment based upon 'reference' number then do the above command to put a new appointment on with the amended details.

if you can help i would really appreciate it :)
 

Users who are viewing this thread

Back
Top Bottom