Data in Combobox control vs. UDF

G

Guest

Hi,
This is a follow-up to a previous question I had regarding the values in a
combobox on a custom form. I am populating the combobox programmatically
through Access. Yet when I send the form, the values are not retained. I
think I've narrowed down the problem to the fact that I am adding the data to
the control, but not to the underlying UDF, so the information is not stored
once it has been sent.
However, when I tried adding to the UDF, it only retains the last value
retrieved. Since this is a combobox, I need it to have multiple values. If
anyone could explain to me how to either:
1) Add multiple values to a UDF for a combo box (through Access VB)
2) transfer values from a control to a UDF

Bonus points if you could clarify for me how a field can store multiple
values (such as for a combobox or listbox) since that's got me foxed.
Much appreciated.
 
S

Sue Mosher [MVP-Outlook]

Changes to controls on Outlook forms are not persisted. That includes adding and removing list rows. The form will always open with the rows in the published form definition.

To handle your scenario, you would need a separate custom property to store the row list and would need to read that list back into the control using the Item_Open event handler. The easiest way to get the rows out of the list is to use the List property to return an array, then use the Join() function to convert the array to a delimited string. The code sample at http://www.outlookcode.com/codedetail.aspx?id=461 shows these techniques in action saving the row list to a text file and could be adapted to save to a custom property instead.

The form would also have to be published to the Organizational Forms library.
 

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