[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

sending Lotus Notes appiontment with MS Access

Posted on 2006-05-09
2
Medium Priority
?
505 Views
Last Modified: 2011-10-03
Maybe this isn't possible, but I'm trying to send a Lotus Notes appointment with the click of a buton in MS Access.  I have a form with one button that runs the function below on click.  When I run the code I get a run-time error '-2147417851 (80010105)':  Automation error The server threw an exception on the line doc.replaceitemvalue "startDateTime", dateTime.  How can I correct this?
FYI.  This code has come from bits and pieces of Q & As I've found.  

Also, if I comment out the lines from doc.replaceitemvalue "startDateTime", dateTime to doc.replaceitemvalue "endTime", dateTime I get a blank email that's sent with this error when you try to open it:  Field 'StartDate_2':  Incorrect data type for operator or @Function:  Time/Date expected.  This will probably be fixed if the above is corrected but may provide more help to my problem.

Public Function SendReminder(Recipient As String, BodyText As String, SaveIt As Boolean)
   
    Const Subject = "May staff meeting (Tuesday the ninth)"
    Const position = "5/9/2006 10:00 AM"
 
    Dim maildb As Object 'The mail database
    Dim userName As String 'The current users notes name
    Dim MailDbName As String 'THe current users notes mail database name
    Dim MailDoc As Object 'The mail document itself
    Dim Session As Object 'The notes session
    Dim doc As Object 'notesDocument
    Dim dateTime As Object 'NotesDateTime

    Set Session = CreateObject("Notes.NotesSession")
    userName = Session.userName
    'Session.Initialize
    MailDbName = Left$(userName, 1) & Right$(userName, (Len(userName) - InStr(1, userName, " "))) & ".nsf"
    Set maildb = Session.GETDATABASE("", MailDbName)
    'Open the mail database in notes
    If maildb.ISOPEN = True Then
        'Already open for mail
        Else
        maildb.OPENMAIL
    End If

    Set doc = maildb.createDocument
    Set dateTime = Session.createDateTime(position)
     
    doc.Form = "Appointment"
    doc.replaceitemvalue "Form", "Appointment"
    doc.replaceitemvalue "$Alarm", 1
    doc.replaceitemvalue "$AlarmOffset", 0
    MsgBox "Setting reminder/alarm - " & dateTime.lslocalTime & " - " & Subject
    doc.replaceitemvalue "startDateTime", dateTime
    doc.replaceitemvalue "endDateTime", dateTime
    doc.replaceitemvalue "calendarDateTime", dateTime
    doc.replaceitemvalue "Subject", Subject
    doc.replaceitemvalue "startTime", dateTime
    doc.replaceitemvalue "appointmentType", "0"
    doc.replaceitemvalue "Alarms", "1"
    doc.replaceitemvalue "startDate", dateTime
    doc.replaceitemvalue "endDate", dateTime
    doc.replaceitemvalue "endTime", dateTime
    doc.Save True, True
    doc.SEND 0, Recipient
    doc.putInFolder "($Alarms)"
   
    'Clean Up
    Set maildb = Nothing
    Set MailDoc = Nothing
    Set Session = Nothing
   
End Function
0
Comment
Question by:drakebcbsks
2 Comments
 
LVL 65

Accepted Solution

by:
rockiroads earned 1500 total points
ID: 16638904
see this post, it mentions a problem with dates. Now I dont know if its applicable to you, but have a look

http://www.fabalou.com/VBandVBA/lotusnotesappointment_ver6.asp

Do the dates have to be in a certain format?
0
 

Author Comment

by:drakebcbsks
ID: 16648394
I finally figured it out.  Within that post there was reference to Joe Korzeniewski of www.vortexwd.net.  When going to that website, I found some VB code that I used to replace what I had.  It took a small bit of alterations, but it now works perfectly.  Thanks for the post.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft Access has a limit of 255 columns in a single table; SQL Server allows tables with over 255 columns, but reading that data is not necessarily simple.  The final solution for this task involved creating a custom text parser and then reading…
Explore the ways to Unlock VBA Project Password Excel 2010 & 2013 documents. Go through the article and perform the steps carefully to remove VBA Excel .xls file.
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question