Lotus Script errors type Mismatch

Posted on 2014-07-14
Last Modified: 2014-07-14
Lotus scripting is getting over my head.

I have an issue I'm working on within an agent.  I have an autogenerated email  that builds the body of the email and then sends it.  within the message I want to send a value from the form that is getting selected for the email.  I have this AppendText :
Call rtitem.AppendText( "Incident Source:  " + src + Chr(13) + Chr(13) + "This is a Daily Notification Process indicating you have an open IR older than 5 days that Requires your attention. " + Chr(13) + "Please Open, Review and Update the IR." + Chr(13) + Chr(13) + "A Final Root Cause and Resolution are Required. " + Chr(13) + Chr(13) + "Thank You !" + Chr(13) + Chr(13) + "Open IR Document Link  ->  " )
            Call rtitem.AppendDocLink( curdoc, doc.Subject( 0 ) )

this is just a message body of the email.  I'm trying to add the first part, "Incident Source:  " + src + Chr(13) + Chr(13) +
the 2 chr gives me 2 line feeds.  The problem is when trying to add field value src I get the mismatch
I have it defined above as Dim src As NotesItem and then Set src = curdoc.GetFirstItem( "Incident" )

plus I'm trying to add the src value to the error at the end if there is one in this.
MsgBox "Error in Send: " + src & Error$

Question by:pratigan
    LVL 46

    Accepted Solution

    Hi Paul,

    A NotesItem is not a valid operand for the plus-operator that you use to concatenate strings. The ampersand-operator is more lenient when it comes to concatenation, but in this case it wouldn't have mattered: you simply cannot concatenate a string with a NotesItem. Try src.Text instead, for a quick fix.

    I personally almost never work with GetFirstItem, when I know the type of the value of the field. If the Incident field contains one string value, you may get it using
       Dim s As String
       s= curdoc.GetItemValue("Incident")(0)
    The call returns an array of values, so you need the (0) to get its first value.

    Just another remark: instead of the chr(13) call you can
    - use Chr$(13): this is a string, whereas Chr(13) returns a Variant which needs a conversion
    - use rtitem.AddNewline(1): this is platform-independent, Chr$(13) is ASCII
    LVL 4

    Author Comment

    Fantastic... Sjef .. you are truly a master.
    Thank You So Much !!

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    For beginners of Lotus Notes user this is important to know about the types of files and their location supported by IBM Notes. Mostly users are unaware about how many file types are created and what their usages are. This Article is fully dedicated…
    Article by: Rob
    Notes 8.5 Archiving Steps and Tips This article covers setting up a Notes archive, and helps understand some of the menu choices making setting up and maintaining a Notes archive file easier.
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

    779 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

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now