in

InfoPath Dev

Activating Secondary Data Connections to populate Drop down fields only when selected ?

Last post 07-01-2008 07:55 AM by Hilary Stoupa. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 07-01-2008 04:51 AM

    Activating Secondary Data Connections to populate Drop down fields only when selected ?

    Hi, I am having an issue with my form taking a long time to load-up. After playing around, i can pin it down to the number of secondary data connections i have set-up to "Automatically Retrieve Data When Form is Opened" which i need in order to auto populate the many drop-down fields from my Access database. By the way, i know a web service would solve this problem but this is not an option.

    I know i can make these additional  connections as "non automatic retrieval" and create a seperate button to populate the relevant drop-down, but this is a bit messy. Ideally i would like to modify the code so that when a drop down is selected, it will retrieve the look-up data. Is this possible and what code would i need to add, bearing in mind im not really a programmer.

    Any help would be much appreciated.

     

  • 07-01-2008 07:55 AM In reply to

    Re: Activating Secondary Data Connections to populate Drop down fields only when selected ?

    Hi:

    Your secondary data connection query can be run with a single line of code. In C#:

    this.DataConnections["DataConnectionName"].Execute();

    With "DataConnectionName" replaced with the name of your data connection. However, the trouble that you will have is finding an event to connect this to. The events associated with most controls (like the dropdown) in InfoPath 2007 are Changing, Validation, and Changed. For a full description of these three events, please see: http://msdn.microsoft.com/en-us/library/microsoft.office.infopath.xmlevent_events(VS.80).aspx . There isn't an event that runs when a control is selected.

    If you have other fields that are always filled out before a user would need the drop down, you could add the code to an event related to those fields, but that is a bit of a gamble, as you are betting the user fills out the form in a certain order... I suppose you could hide the drop down until the previous fields are filled out....

    Hilary Stoupa / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
    Filed under:
Page 1 of 1 (2 items)
Copyright © 2003-2007 Qdabra Software. All rights reserved.
View our Terms of Use.