How to: display multiple rows of data from an Access DB in a form - InfoPath Dev
in

InfoPath Dev

How to: display multiple rows of data from an Access DB in a form

Last post 01-25-2010 09:15 AM by geoffgarcia. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 01-22-2010 01:40 PM

    How to: display multiple rows of data from an Access DB in a form

     I apologize for my noobish question...

    I'm trying to create an order form in InfoPath 07.

    I'd like the form to display a list of inventory (pulled from an Access DB) and have fields to the right of each item where they can select how many of the item they want to order.

    Step 1 is to display the list of item names, and I've been going all over looking for a basic "how-to" and haven't been able to get anything to work.

    Can anyone help me with this painfully simple thing?

    I have a single database, with a single table (Inventory), that has a single row (name), and want all the data to be displayed in the form.
    I've attached the db without a problem, and I suppose my question is, what control do I use? and how do I get it to display all the data from the db?

    Thanks for any advice.

  • 01-22-2010 02:54 PM In reply to

    Re: How to: display multiple rows of data from an Access DB in a form

    I partially figured this out.

    Attempt 1:

    I created an InfoPath form using the database template. I connected it to a table called Inventory that had one table with 5 rows of data.  I right clicked on the myFields/dataFields and dragged the column names to the WYSIWYG area and selected "Text Box (repeating)" as well as other options, and when I preview the form I get no data.

    Attempt 2:

    When I do the EXACT same thing using the blank template I noticed that the database is set as a secondary data source, and when I preview the form it works as expected.  I've gone back to my attempt 1 file and I'm still unable to determine how one would accomplish the same thing using that database template instead.  Thoughts?

  • 01-23-2010 03:22 PM In reply to

    Re: How to: display multiple rows of data from an Access DB in a form

    Hi --

    I may not understand exactly what you are trying to do, here, so please correct me if I've misunderstood. It sounds like you want to create a DB bound form for updating your inventory table? Or is it that you simply want to be able to display all the existing items in your inventory table in a form?

    The trick is making sure the query to the table is being run when the form is opened. When you created your secondary data connection to the table, by default InfoPath would have set that connection to query on load. But I think with a DB bound form, you have to add a rule to run the query on the main connection to load your data. So, using your initial trial form, add an open rule (under Tools / Form Options / Open and Save -- look for the Rules button) and have that rule have an action of 'Run a Query' using your Main data connection for the query source.

    Hilary Stoupa

  • 01-23-2010 03:51 PM In reply to

    Re: How to: display multiple rows of data from an Access DB in a form

     In my opinion your attempt 1 is the best way to accomplish what your're trying to do. Design a new form template based on your Access database. Then on the task pane it should display your datasource. From the datasource, drag dataFields onto the form section where it says "Drag data fields here" select Section with Controls. This will produce a Repeating Section. You can convert this Repeating Section to a Repeating Table by right-clicking then select Change To then select Repeating Table. Drag queryFields onto the form section where it says "Drag query fields here" selecting Section with Controls as well. This will result with an Optional Section. From this Optional Section remove the controls you don't want to use as filter in your query just retain maybe one control to use for querying your database.

    Now preview your form then enter your query... or just leave the query blank to return all your records. Click on Run Query and you'll see the result on the Repeating Section.

    HTH

     

    using Microsoft.Office.InfoPath;
  • 01-25-2010 09:15 AM In reply to

    Re: How to: display multiple rows of data from an Access DB in a form

    Thanks Hilary, I modified the form from my initial attempt the way you suggested and it worked perfectly.

    I'm trying to: display all the existing items in your inventory table in a form.

      

    Thanks for your input also Jett!

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