How to Save with code? - InfoPath Dev
in

InfoPath Dev

How to Save with code?

Last post 04-26-2009 03:08 PM by ocampod84. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 02-21-2009 01:10 AM

    • kmanji
    • Not Ranked
    • Joined on 02-12-2009
    • Posts 4

    How to Save with code?

    Hi Guys.

    I've made a quotation form which will be used by different salespersons, each on their account on a local server. I want to be able to enable them to save the form on their own account, using a filename that is created from a field in the form.

     

    Eg. Save form1 as "Quotation-fieldCustomerName-fieldDate" in the folder c:\salesperson1\quotations\filename

    salesperson1, salesperson2 would be the windows login account of the salesperson.

     

    Please assist if you can.

    Thanks.

    Kumail.

  • 04-21-2009 02:32 PM In reply to

    You can use this code to start you off:

    If Me.[New] Then

    Me.SaveAs("C:\form.xml")

    Else

    Me.Save()

    End If

    You will need to make references to nodes in order to get a custom file name.

  • 04-21-2009 11:00 PM In reply to

    • kmanji
    • Not Ranked
    • Joined on 02-12-2009
    • Posts 4
    Hi... Thanks for the reply. I have pretty much relied on the no-code options of infopath to create the entire form, as I don't know JS or VB. Whenever I tried using code, the form did not open, and I had to remove it (I was probably doing it all wrong). Is it possible to assist me on how to reference the nodes to get a custom filename? I couldn't figure that out. Thanks for all your help. Kumail.
  • 04-26-2009 03:08 PM In reply to

     In VB, to work with the DOM, you'll need to enter the following code:

    Dim DOM as XPathNavigator = MainDatasource.CreateNavigator()

    To reference a node, you'll need to copy the XPath from the node's data source and paste it into code:

    Dim field1 as XPathNavigator = DOM.SelectSingleNode("xpath", NamespaceManager)

    Look up MSDN's help with using the InfoPath 2007 Object Model

Page 1 of 1 (4 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.