Hello all:
I have a form that populates a listbox and a text box in Access 2003/Access 2003 MDB format.
Typing a name in the text box triggers a "FindFirst" routine that attempts to match the information in the text box with a column in the list box. The user can then double click the matched information in the list box and be taken to the record.
This works fine in Access 2003, but has stopped working in Access 2007. The form works normally in 2007 with the exception of the "FindFirst" function.
Any insight as to what I am missing would be appreciated.
Here is my code:
What am I missing here? What did Access 2007 break?
I have a form that populates a listbox and a text box in Access 2003/Access 2003 MDB format.
Typing a name in the text box triggers a "FindFirst" routine that attempts to match the information in the text box with a column in the list box. The user can then double click the matched information in the list box and be taken to the record.
This works fine in Access 2003, but has stopped working in Access 2007. The form works normally in 2007 with the exception of the "FindFirst" function.
Any insight as to what I am missing would be appreciated.
Here is my code:
Code:
Private Sub TxtBox_KeyUp(KeyCode As Integer, Shift As Integer)
str = TxtBox.TExt
strSQL = ListBox.RowSource
Set db = CurrentDb()
Set rs = db.OpenRecordset(strSQL)
rs.MoveFirst
[COLOR=green]'[VENDORID] is the first column of the listbox and matches the information being input into the TextBox[/color]
With rs
.FindFirst "[VendorID] LIKE '" & str & "*'"
If rs.NoMatch Then
Exit Sub
Else
i = (rs.AbsolutePosition) + 1
ListBox.Selected(i) = True
Exit Sub
End If
End With
[COLOR=green]'Close the recordset and database, then reset them to nothing.[/color]
rs.Close
db.Close
Set db = Nothing
Set rs = Nothing
str = ""
End Sub
What am I missing here? What did Access 2007 break?