On 3 Jan 2004 08:48:47 -0800,
Su**********@aol.com (Support4John)
wrote:
Any example code?
John, I'm not sure what you are trying to do with this, but maybe the
following will give you some idea of an approach.
Assuming a combo box name cboMyCombo. Not knowing your row source type
and what you are doing with the input...
First create a module variable - at the top of the module in the
Declarations section:
Dim mstrCbo As String
Code like the following in the appropriate control events:
Private Sub cboMyCombo_KeyPress(KeyAscii As Integer)
Dim str As String
str = Chr(KeyAscii)
If str Like "[a-zA-Z0-9]" Then
mstrCbo = mstrCbo & Chr(KeyAscii)
End If
End Sub
Private Sub cboMyCombo_BeforeUpdate(Cancel As Integer)
Dim intItems As Integer
If Len(mstrCbo) > 0 Then
For intItems = 1 To Me.cboMyCombo.ListCount
If Me.cboMyCombo.Column(0, intItems - 1) = mstrCbo Then
MsgBox mstrCbo & " is in list!"
Exit For
End If
Next
End If
End Sub
Private Sub cboMyCombo_AfterUpdate()
mstrCbo = ""
End Sub
- Jim