Switching Views w/VBScript - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

Switching Views w/VBScript

Last post 09-01-2005 10:15 AM by Greg Collins. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 08-30-2005 09:30 AM

    Switching Views w/VBScript

    I am trying to switch views based on a Queried value using VBScript. The following is my Script followed by the error message I get when I try to Preview the form.

    Script
    Sub XDocument_OnSwitchView(eventObj)
    Ifhttp://d:Person/@cd_Sex = "M" Then,
    XDocument.View.SwitchView(MaleExam)Or
    Ifhttp://d:Person/@cd_Sex = "F" Then,
    XDocument.View.SwitchView(Female_Exam)
    End Sub

    Error Message
    InfoPath cannot open the selected form because of an error in the form's code.
    The following error occurred:

    Expected 'Then'
    File:script.vbs
    Line:50
    Ifhttp://d:Person/@cd_Sex = "M" Then,

    Any assistance would by greatly appreciated.

    Thanks
    Smitty
  • 09-01-2005 10:15 AM In reply to

    Re: Switching Views w/VBScript

    You, unfortunately, are not allowed to switch views inside of the OnSwitchView event handler. I have wanted to do this many times, but it is not allowed. You can switch views during OnLoad and during OnClick (and I think also OnAfterChange -- but I'm not sure).

    Outside of those, you will not be able to do this.
Page 1 of 1 (2 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.