User form combo box change from code behind
I have a user form which is launched when the document is opened. A value is chosen from a combobox on the form and some other values are set on textboxes on the form. When the user clicks a command button the value from the combo box is used to find a row on a table in the word document then the index of the selected list item is changed and the user can then click the command button to run the process again.
The problem is that the index is successfully updated and the next value is displayed in the combo box but the value is always empty when read from the code behind.
The code that changes the combo boxes item is very simple:
Private Sub CommandButton1_Click()
On Error GoTo ErrHandle
Dim cmbtxt As String
cmbtxt = InputForm.Datecmb.SelText
Dim idx As Integer
idx = InputForm.Datecmb.ListIndex
'Do some work here
'then set the Datecmb list index to the next index
InputForm.Datecmb.ListIndex = CInt(idx + 1)
' then exit sub
Exit Sub
ErrHandle:
MsgBox (Err.Description)
End If
Resume Next
End Sub
Can anyone sugest what the issue is?
|