Drop down listbox connected to MsAccess database - InfoPath Dev
in

InfoPath Dev

Drop down listbox connected to MsAccess database

Last post 05-05-2007 08:33 PM by Matt Faus. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 12-01-2006 02:59 AM

    • reijndert
    • Not Ranked
    • Joined on 11-30-2006
    • Netherlands
    • Posts 9

    Drop down listbox connected to MsAccess database

    Problem:
    In my form I have several dropdown listboxes connected to an msaccess database. How can I 'force' a default selection? I alway get a blanc line as default. In some cases no problem, but sometimes I want to get the default selected without clicking.

    Example
    =======
    listbox1 dataconnection:
    select [description] from [department] as [department]

    Since this is the first listbox, a blanc default is no problem, you just have to select the rights department

    listbox2 dataconnection:
    select [name] from [executives] as [executives]

    This second listbox gets a filter, based on the departmentcode extracted from listbox1.
    (I cannot use a sql-query as filter... Found another solution that worked).

    All works fine, but in listbox2 I ALSO get a blanc line as default, even if there is only 1 result!!.

    In the case of 1 result I want this result to be defaulted, all other cases a blanc default is no problem.

    Any suggestions?

  • 05-05-2007 08:33 PM In reply to

    Re: Drop down listbox connected to MsAccess database

    Hi reijndert,

    First of all, I would suggest that you take a look at this blog post, it might be helpful: http://www.infopathdev.com/blogs/matt/archive/2006/01/09/Create-a-Multi_2D00_View-Master_2F00_Detail-using-a-Query-Filter.aspx

    To set the default value of the drop-down you can do this in code by setting the value of the node to one of the values returned from the database. To do this, simply copy the first value from the database results to the node for the drop-down.
    Matt Faus / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
Page 1 of 1 (2 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.