Expected ';' Error - InfoPath Dev
in

InfoPath Dev

Expected ';' Error

Last post 03-22-2009 07:12 PM by Jimmy. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 03-22-2009 07:06 PM

    Expected ';' Error

    I copied this code from another post, and I'm now getting this error:

    Expected ';'
    File:script.js
    Line:38
    Sub updateDateDiff

    Can you help?

    Here's the code:

    function msoxd_my_Date2::OnAfterChange(eventObj)

    {

    if (eventObj.IsUndoRedo)
    { 
    return;
    }
    Sub updateDateDiff
    Dim fromDate
    Dim toDate Dim days
    Dim daysNode
    set daysNode = XDocument.DOM.selectSingleNode("/my:myFields/my:DaysRemaining")

    fromDate = Trim(XDocument.DOM.selectSingleNode("/my:myFields/my:Date").text)
    toDate = Trim(XDocument.DOM.selectSingleNode("/my:myFields/my:Date2").text)

    if Len(fromDate) = 0 Or Len(toDate) = 0
    Then daysNode.text = "n/a"
    else
    fromDate = CDate(fromDate)
    toDate = CDate(toDate)
    days = DateDiff("d", fromDate, toDate)

    ' Determine whether the xsi:nil attribute is set for this
    ' element. If so, remove the xsi:nil attributes so that
    ' the value can be set.

    if Not IsNull(daysNode.getAttribute("xsi:nil")) then daysNode.removeAttribute("xsi:nil")
    end if
    daysNode.text = CStr(days)
    end if
    } 

    Thanks.

  • 03-22-2009 07:12 PM In reply to

    The code you borrowed is VBScript code, but your form is set for JScript.

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
Page 1 of 1 (2 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.