Mega Code Archive

 
Categories / VisualBasic Script / Access
 

Set Index and seek the recordset

Sub exaRecordsetSeek()     Dim db As Database     Dim rsTable As Recordset          Set db = CurrentDb          Set rsTable = db.OpenRecordset("Books")     rsTable.Index = "Title"     rsTable.Seek ">=", "On"     If Not rsTable.NoMatch Then         Debug.Print rsTable!Title     Else         Debug.Print "No title beginning with word 'On'."     End If          rsTable.Close End Sub