scott56
07-23-2010, 01:47 PM
Hi,
I have a userform I am modifying and I have placed a new combo box on it. Using a standard approach to populate it and then I want to set the value of the box to read "Select Existing Record..." when I hit this statement it reports "Could not set the value property. Invalid property value"
I have the style set to "0 - fmStyleDropCombo" which on reading other posts should allow the Combo value to be set to anything that is not in the list.....for some reason this seems to be overridden...
When I change the line .frmExistingRecordsComboBox.Value = "Select Existing Record..." to be equal to a value in the first column of the combo box it passes this line and sets the form with the combo box equal to that item in the list.....
Sub PopulateExistingRecordsComboBox()
'This routine will populate the Existing Records Combo Box
Dim myRange As Range
Dim i As Integer
With AD_DataEntry
.frmExistingRecordsComboBox.Clear
Set myRange = Worksheets("Data").Range("DataStartHeading")
i = 1
Do While myRange.Offset(i, 0).Value <> ""
With .frmExistingRecordsComboBox
.AddItem myRange.Offset(i, 0).Value
.List(.ListCount - 1, 1) = myRange.Offset(i, 4).Value
.List(.ListCount - 1, 2) = myRange.Offset(i, 1).Value
End With
i = i + 1
Loop
.frmExistingRecordsComboBox.Value = "Select Existing Record..."
End With
End Sub
Any help appreciated...
I have a userform I am modifying and I have placed a new combo box on it. Using a standard approach to populate it and then I want to set the value of the box to read "Select Existing Record..." when I hit this statement it reports "Could not set the value property. Invalid property value"
I have the style set to "0 - fmStyleDropCombo" which on reading other posts should allow the Combo value to be set to anything that is not in the list.....for some reason this seems to be overridden...
When I change the line .frmExistingRecordsComboBox.Value = "Select Existing Record..." to be equal to a value in the first column of the combo box it passes this line and sets the form with the combo box equal to that item in the list.....
Sub PopulateExistingRecordsComboBox()
'This routine will populate the Existing Records Combo Box
Dim myRange As Range
Dim i As Integer
With AD_DataEntry
.frmExistingRecordsComboBox.Clear
Set myRange = Worksheets("Data").Range("DataStartHeading")
i = 1
Do While myRange.Offset(i, 0).Value <> ""
With .frmExistingRecordsComboBox
.AddItem myRange.Offset(i, 0).Value
.List(.ListCount - 1, 1) = myRange.Offset(i, 4).Value
.List(.ListCount - 1, 2) = myRange.Offset(i, 1).Value
End With
i = i + 1
Loop
.frmExistingRecordsComboBox.Value = "Select Existing Record..."
End With
End Sub
Any help appreciated...