HELP!! Ive tried to do a binary search on the following Access Database through Data1.recordset.
I think that only one line of code needs to be changed: how to specify a Long Variable type to equal the first record in the database.

Its highlighted in red below, I think this is all that needs to be changed, but am not sure.....

Option Explicit

Dim db As Database
Dim rs As Recordset

Private Sub Command1_Click()
Dim hit As Boolean, fTop As Long
Dim fBott As Long, fTmp As Long

Just a note. If you drop Data control and do 'all in code' (and better yet switch to ADO) a recordset opened with the following sql will return the needed result:

"Select * From Table1 Where [Staff Number] = '" & txtSearch.Text &"'"

Shurik.

rprewitt

04-16-2004, 02:55 PM

If that line of code would work then you could also put it in the recordsource value of the data control ;)

MKoslof

04-16-2004, 06:07 PM

I don't understand what you are trying to do with the recordset. You aren't looping within the recordset, so I assume you are always on the first value. And, then you never close the recordset or update it. And what is Data1? I assume this is some data control, but you also DIM a recordset and database at the top of your code piece (db and rs) but you never use these variables anywhere.