>ADO
>rsExtension.Filter = "ExtNum=" & listExt.SelectedItem
>
>Normally, "listExt.SelectedItem" returns a 3 or 4 digit number (i.e. "200") and the Filter works fine.
>
>Ocassionaly, "listExt.SelectedItem" returns a Chr and a number (i.e. "L25"), at which point the Filter returns Run-time error 3001.
>
>How can I make the Filter accept a Chr/Num combination like this?
Is this for a ListView control? The regular VB listbox doesn't have a SelectedItem property.
Anyway, assuming that
listExt.SelectedItem returns a list's item text and if the ExtNum field is a char type, it should work if you always enclose the filter condition within single quotes:
rsExtension.Filter = "ExtNum='" & listExt.SelectedItem & "'"
It wouldn't make much sense that you would be looking for different types in the same field anyway.
HTH