Combo Box won't select a second record w/ the same info...

G

Guest

I have a combo box that does a search by the last 8 of a VIN from an
automobile. Sometimes we will transport an automobile 2 or 3 times. When you
put the last 8 in the combo box it shows that there is a second record in the
list, but if you try to select that second record, the form will only remain
on the first record it finds.

I have another database for repossessing vehicles, I have used the same code
and I don't have this problem as I do for the transporting database. Any
ideas? Thanks, maura

Here is the code:

Private Sub Combo52_AfterUpdate()

Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "right([transVin],8)= '" & Me![Combo52] & "'"
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub
 
M

Marshall Barton

maura said:
I have a combo box that does a search by the last 8 of a VIN from an
automobile. Sometimes we will transport an automobile 2 or 3 times. When you
put the last 8 in the combo box it shows that there is a second record in the
list, but if you try to select that second record, the form will only remain
on the first record it finds.

I have another database for repossessing vehicles, I have used the same code
and I don't have this problem as I do for the transporting database. Any
ideas? Thanks, maura

Here is the code:

Private Sub Combo52_AfterUpdate()

Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "right([transVin],8)= '" & Me![Combo52] & "'"
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub


That code finds the first record in the form's record source
table/query. If you want it to find a different record, you
need some identifying information for the second (or third)
record.

Maybe the combo box could have the entire VIN in another
column in its row source. if that's possible, then the find
first could be:

rs.FindFirst "transVin = '" & Me!Combo52.Column(1) & "'"

Be sure to adjust the combo box's ColumnCount, BoundColumn
and ColumnWidths properties if you change the row source
query.
 

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

Top