Hi,
I am using Microsoft Infopath to try and create a front end for a access database. I have a data source which stores an id number for the customer. This id number relates to a secondary data source called tblUsers. the id field then relates to the users forename, surname, email address etc. When the customer id is selcted in a drop down list box, the email address is shown in the box using the secondary data source.

What I need to do is use the display name of the drop down box, not the value, to populate another expression box. I have the following Xpath. Does anyone know where I am going wrong.

xdXDocument:GetDOM("tblUsers")/dfs:myFields/dfs:dataFields/d:qryAllUsers/@email1[xdXDocument:GetDOM("tblUsers")/dfs:myFields/dfs:dataFields/d:qryAllUsers/@ID = dfs:dataFields/d:tblOrders/@_customerid]

Please Help:'(

Hi.

I am attempting to do the same thing in Infopath right now (trying to populate fields using a secondary source's display name rather than value) and have seen you ask this question on another website. Did you end up having any luck solving this problem?

Thanks

Hi,
The answer was given to me on one of the other forums. There is a Microsoft article which explains it in more detail, but I can't remember where it was sorry. Basically the way I had to do it was create a text box that was not linked to any of the datasources eg. my:{new box}, then I set up a rule on the drop-down box. This rule always applies, it is to set a fields value. Set the field value for my:{new box}

Value = (from your secondary data source holding th id and display) the display value wanted. Then before you click OK Click Filter Data in the bottom Left.

In this screen select the first field as your index "is equal to" the value from your primary source that is in a drop down box.

This should do the trick and your XPath should now look something like this:
@{display}[@{Value}=@{Primary}]

I know this is not a great way of explaining things. Please excuse my dislexic way of explaining.

If you want to you can contact me brittaink112@scampton.raf.mod.uk and I may be able to email you some screen shots.

Hope this helps

Keith Brittain

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.