programatically create secondary data connections - InfoPath Dev
in

InfoPath Dev

programatically create secondary data connections

Last post 12-13-2007 05:35 PM by Clay Fox. 5 replies.
Page 1 of 1 (6 items)
Sort Posts: Previous Next
  • 12-13-2007 04:59 AM

    programatically create secondary data connections

    Hi

    I'm new to infopath and was wandering if it is possible to programatically create secondary data connections using vbscript once the form is opened

    thanks

  • 12-13-2007 07:58 AM In reply to

    Re: programatically create secondary data connections

    That is a good question.  What type of data connections are you wanting to make?

    You can make connections in code which are outside of InfoPath.

    I believe InfoPath sets up all of the DataConnections in the beginning, so I am doubtful they can even be modified while the form is running.  Typically you would make several and then just use logic to pick the one you need in each scenario.  What is driving this need to dynamically set them while the form is open?

  • 12-13-2007 02:58 PM In reply to

    Re: programatically create secondary data connections

    This is the situation.

    Currently the form takes a long time to open as the secondary data connections (MS Access Database) used to populate dropdown lists are situated on a slow network drive.  To overcome this problem, I have placed a copy of the database on the users local drive and in the on-load event I check if there have been any updates to the original database and if so update the users copy.  This all works fine until I have a new user of the form who does not yet have the database on their local drive and they receive an error not being able to connect to database.  I have some code to create the directory and copy the database over but unfortunately the form tries opening the data connnection before the on-load event.  So my next thought was to eliminate the data connections so that a new user can open the form, the code in the on-load event will create directory and copy database to local drive and then I would programatically create the data connections used to fill the dropdown lists.

    Hope this all makes sense.  Not sure if this is possible or the best way to do it.  Any help will be appreciated.

    By the way I am using Infopath 2003 and vbscript.

     Thanks.

  • 12-13-2007 04:21 PM In reply to

    Re: programatically create secondary data connections

    Kyle....Dude...

    This is an eleborate, yet impressive, strategy for overcoming performance issues.

    Best Practice would be to look at the Database Accelerator, Qdabra Database Accelerator Suite Version 2.1 - Developer and switch to accessing your tables via web services.  These will perform better over the network and you can query on secondary connections, so you only get the data you need.  It will also lets you save the data in your forms in SQL as well. 

    For your current strategy, it sounds like you have your secondary data connections set with the default to load automatically.  I would recommend you turn this off. That way you can control when they are called. You can have them run after your database copy is complete.

     If you would like more info on Web Services let me know.

    Filed under:
  • 12-13-2007 05:06 PM In reply to

    Re: programatically create secondary data connections

    Thanks Clay,

    I will have a look at Database Accelerator and I don't know anything about Web Services so any help would be appreciated.

    As for my current strategy, I have set the secondary data connections to NOT automatically load but it seems that when the infopath form opens it still checks the connection and brings up an error if it cannot find it.  If I can somehow run my code before infopath checks the data connection this would solve my problem.

  • 12-13-2007 05:35 PM In reply to

    Re: programatically create secondary data connections

    Yah that is right, it does check for their existence.

    The only thing I could think of is to create a script and .bat file that the user uses instead fo the template directly.  It could verify the DB and prep if neccessary and then launch the form.  I think that would be the only way to get ahead of that check.

    Send me an email and we can setup a time to show you what could be done with web services.

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