Dropdown list in repeating table fails to show modified data sourc

M

Mike Frumer

I am using managed code to allow a user to add values to a dropdown list.

I have a repeating table which includes a dropdown list and some text boxes.
It also icludes a button to allow the user to add an entry to the dropdown
list. The data source for the dropdown list is an Access table.

When the user clicks the button, the form switches to a view which contains
a text box in which the user enters the new value for the dropdown. The user
then clicks a button. My vb.NET code adds the new value to the Access
database table and switches the view back to the repeating table. The managed
code uses thisXDocument.DataObjects("Projects").Query() and
thisXDocument.View.ForceUpdate() in the OnSwitchView event to repopulate the
dropdown.

The new entry is shown as the selcted value in the dropdown, and it also
appears in the list for the dropdown. This is exactly what I want to happen.

HOWEVER, when the user adds a row to the table and drops the dropdown list
down, the new value is not in the list. The value is still in the dropdown
for the first row, and it is in the Access table.

I tried using the thisXDocument.DataObjects("Projects").Query() and
thisXDocument.View.ForceUpdate() in the OnContextChange event because that
event fires when the row is added to the table. That did not help.

Strangely, when I traced the OnContextChang event, the
thisXDocument.DataObjects("Projects").Query() executed, but when I stepped
the code, it did not go to the next line, which is the
thisXDocument.View.ForceUpdate(). It apparently just exits the subroutine.

I am new to InfoPath and managed code, and it has taken me a lot of effort
to get this far. I would greatly appreciate help with this last step.
 

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