mi**@geographx.co.nz wrote:
Hi All
I have a combo box that sources from a field and enables me to autofill
if I have the properties as such:
Column count: 2
Bound Column: 1
Column Width: 0
Auto expand: yes
I think I can use the column width = 0 so it will read the second
column as the first column is just the ID and it is the second column
which is the important one.
However an error comes up namely: The value you entered isn't valid for
this field
Although the value is text and not numeric. This error doesn't allow
you to do anything more.
If anybody can help out with this it would be greatly appreciated.
Cheers,
Mike
I would think that you'd have something like
ColumnWidths 0";1"
Width = 1"
IOW, you have 2 columns, the first column is hidden. Setting the Width
to 0 would make it very difficult to select anything from the combo.
I'm not even sure if you could access the dropdown button.
Here is some code I put into the OnClick event of a combo box named
Combo0. Drop it into your OnClick event of your combo and change Combo0
to the name of your combo box.
Private Sub Combo0_Click()
Dim intIncrement As Integer
'see if columnheading is on or off. Returns 0 False or -1 True
intIncrement = (Me.Combo0.ColumnHeads = True)
'get the index of the selection and add the column headings
'value. Use Abs to convert -1 to 1
intIncrement = Me.Combo0.ListIndex + Abs(intIncrement)
MsgBox intIncrement & " " & Me.Combo0.Column(1, intIncrement)
End Sub
Important Combo/Listbox properties include ListIndex, ListCount,
ItemsSelected, ItemData, Column, and Selected. Look these up in OnLine
help and check out the examples for more clarification.