Problems with getting data from my infopath form | VBScript - InfoPath Dev
in

InfoPath Dev

Problems with getting data from my infopath form | VBScript

Last post 11-14-2008 04:24 AM by Jimmy. 6 replies.
Page 1 of 1 (7 items)
Sort Posts: Previous Next
  • 11-14-2008 12:54 AM

    Problems with getting data from my infopath form | VBScript

    Dear all,

    I want to create an appointment in outlook via VBScript in infopath. Therefore I used
    this code:

    Dim objOutlook
    Dim itmAppt
    Dim raum

    set raum = XDocument.DOM.selectSingleNode("/my:KickOffRaum")

    Set objOutlook = CreateObject("Outlook.Application")
    Set itmAppt = objOutlook.CreateItem(1)
    itmAppt.Resources = raum.text
    itmAppt.Subject = "Test"
    itmAppt.Start = "07/07/08 4:15pm"
    itmAppt.Duration = 60 itmAppt.AllDayEvent = False
    itmAppt.ReminderSet = True
    itmAppt.ReminderMinutesBeforeStart = 5 Set myRequiredAttendee =
    itmAppt.Recipients.Add ("Gueldenring, Marco") myRequiredAttendee.Type = 1
    itmAppt.save

    But it doesen't work. I get an error message:

    Object requiered 'raum'

    What's the error?

  • 11-14-2008 01:12 AM In reply to

    Re: Problems with getting data from my infopath form | VBScript

    Hi,

     Verify what is the value for ‘XDocument.DOM.selectSingleNode("/my:KickOffRaum")‘ . If it is null then raum.text  will throw an error.  

     

    Swathip
    www.ggktech.com
  • 11-14-2008 01:27 AM In reply to

    Re: Problems with getting data from my infopath form | VBScript

    The field my:KickOffRaum in my form is a dropdown field with text values.
    Before clicking the button behind the code i have choosen a value.

  • 11-14-2008 01:51 AM In reply to

    Re: Problems with getting data from my infopath form | VBScript

    "/my:KickOffRaum" can't possibly be the correct XPath for the node, unless your entire form has only one field in it.

     If there is only one field called KickOffRaum in your form, then the XPath "//my:KickOffRaum" (note the two slashes) should work.

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 11-14-2008 01:56 AM In reply to

    Re: Problems with getting data from my infopath form | VBScript

    I'm sorry. I found the problem. It should be /my:myfields/my:KickOffRaum instead of my:KickOffRaum.

    Now it works. Thanks for the sign...

  • 11-14-2008 02:32 AM In reply to

    Re: Problems with getting data from my infopath form | VBScript

    Another question concerning the code above. I want to check if a checkbox in the same
    form ist active. If this is true I want to give a value to the var verteiler.  But something is
    wrong with the bold line in the code. What is the problem. I also tried true instead of
    WAHR.

     Dim objOutlook
     Dim itmAppt
     Dim verteiler
     dim chec
     
     Set chec = XDocument.DOM.selectSingleNode("/my:meineFelder/my:CheckMM")
     
     if chec = WAHR then
      verteiler = "Gueldenring, Marco"
     end if
     
     if verteiler = "" then
      verteiler = "grrr"
     end if

     Set objOutlook = CreateObject("Outlook.Application")
     Set itmAppt = objOutlook.CreateItem(1)
     itmAppt.Resources = XDocument.DOM.selectSingleNode("/my:meineFelder/my:KickOffRaum").text
     itmAppt.Subject = "Neues KickOff Meeting für Projektnummer " & XDocument.DOM.selectSingleNode("/my:meineFelder/my:PM_NR").text
     itmAppt.Start = XDocument.DOM.selectSingleNode("/my:meineFelder/my:KickOffDatum").text
     itmAppt.Duration = 60
     itmAppt.AllDayEvent = False
     itmAppt.ReminderSet = True
     itmAppt.ReminderMinutesBeforeStart = 5
     Set myRequiredAttendee = itmAppt.Recipients.Add (verteiler)
     myRequiredAttendee.Type = 1
     itmAppt.display

  • 11-14-2008 04:24 AM In reply to

    Re: Problems with getting data from my infopath form | VBScript

    I believe you should be checking

    if chec.text = "true"

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