Infopath and Access

A

adamjpeters

This may be a little longwinded, but I'm just starting out with
Infopath.

Currently I have designed a form linked to a Access database. This form
is used during the creation of new articles of lingerie, so it stores
trims, fabrics in different tables on the DB. All tables are linked by
ID, so an entire form can be populated by querying a ID. This part was
easy and I knocked it up in a few hours.

The hard part was the introduction of a dropdown box, which is used to
populate specific fields automatically. We use this drop down to select
'Blocks' (Which are essentially templates). Each block consists of
roughly 6 fields.

I need to be able to use the dropdown menu to populate the selected
fields without having to create lots of rules each time. I have the
'Introducing Infopath book', but that doesn't cover this.

Thanks for your time!
 
S

Scott L. Heim [MSFT]

Hi,

No worries...my answer is going to be a little long winded! ;-)

I am assuming your drop-down list is getting its data from another Access
table. As such, here are the steps to complete a sample using "Rules" to
set field values:

- Create a new, blank form
- Add a dropdown list to the form with a name of: SelectCustomer
- Add a Repeating Section to the form
- Add 3 text boxes inside the Repeating Section with names of:

txtCustID
txtCustName
txtCustAddress

- Add a Data Connection to the form that looks up to the Customer table
from your Access database
- Use this data connection as the source of data for the SelectCustomer
drop-down list
- Right-click on SelectCustomer, click the Rules button, click Add and
complete these steps:

- Click Add Action
- Choose Set a Fields Value from the Action list
- Click the builder button next to Field and drilldown so you can select
txtCustID from your Main data source
- Click the Insert Formula button next to value, click Insert Field or
Group, select the Customers secondary data source, drilldown to select
CustomerID and then click the Filter Data button.
- Click Add
- In the first drop-down list choose CustomerID
- In the second drop-down list choose Is Equal To
- In the third drop-down list, choose Select a Field or Group, select your
Main data source and then choose your SelectCustomer field
- Click OK 6 times to get you back to the Rule window and then complete
the preceding steps again for the txtCustName and txtCustAddress fields.

** NOTE: What this rule/filter is doing is setting the "txt..." fields to
the value of the field from the Customers secondary data source WHERE the
CustomerID in the secondary data source is equal to the CustomerID you
selected in the drop-down box called SelectCustomer. As you can see, this
is needed so it knows what customer information needs to be added to the
form.

I hope this helps!
Best Regards,

Scott L. Heim
Microsoft Developer Support

This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top