dropdown ideas

  • Thread starter Thread starter Bonnie
  • Start date Start date
B

Bonnie

Hi All,

I have an form in which we key VINs. I have a second table that has example
of valid VIN layouts and I would like to drop down/open a read only box on
the form that shows examples of these valid vins (looked up in the second
table) after keying the first 4 digits of a VIN. Anyone have an ideas?

Bonnie
 
Hi All,

I have an form in which we key VINs. I have a second table that has example
of valid VIN layouts and I would like to drop down/open a read only box on
the form that shows examples of these valid vins (looked up in the second
table) after keying the first 4 digits of a VIN. Anyone have an ideas?

Bonnie

You could do this in the VIN control's Change event. This fires at every
keystroke. You could put a Listbox control on the form, unbound, named
lstValidVins, and set its row source as you type. Untested air code:

Private Sub VIN_Change()
Dim strSQL As String
If Len(VIN.Text) = 4 Then
strSQL = "SELECT VINfield FROM ValidVins WHERE " _
& "[ValidVin] LIKE '"Left(VIN.Text, 4) & "*'"
Me.lstValidVins.RowSource = strSQL
End If
End Sub

You might need to requery lstValidVins and/or Repaint the form - as I say,
this is untested.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top