Combo Box

W

Weste

I have a 2 column combo box - column 1 is the bound column. The combo box's
items are populated when the document is opened. The list is populated as
shown below:

col 1 col2
1 Test
2 Test2

The column widths are 0pt;10pt (The user doesn't need to see col 1) . When
item 1 is selected, Test is correctly displayed in the combo box . However,
if I then save the form and then re-open it, 1 is displayed in the combo box
vs Test. Why is this happening and what do I need to do so Test is still
displayed when the form is re-opened? Thanks for the help.

Weste
 
S

Sam

I can't reproduce the problem. What do you mean when you say you're "saving"
the form then reopening it? Saving it in the VBE?? I've followed your specs
and the combobox displays as it should. Is there other code that repopulates
the combobox or changes its list items/columns/formatting/etc?
 
W

Weste

The Word doc is named Test.doc

The following is the code

Private Sub Document_Open()
FillComboBox
End Sub

Sub FillComboBox()

Dim aryTest(1, 1)

aryTest(0, 0) = 1
aryTest(0, 1) = "Access"
aryTest(1, 0) = 2
aryTest(1, 1) = ".Net"

Me.ComboBox1.List = aryTest

End Sub

When I open Test.doc I select item the first item from the combo box which
is "Access". "Access" displays correctly in the combo box. Then I save
Test.doc. When I re-open Test.doc 1 displays in the combo box vs "Access".

Not sure why "Access" is no longer displaying. Any help is greatly
appreciated.

Weste
 
W

Weste

Figured out the solution. I need to use custom properties within Word to
save the user's selection and later retrieve it when the file is re-opened.

Weste
 

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