I've got a problem I have't run up against before. I generally test
for an empty recordset using BOF and EOF. Today, for the first time I
ran into a problem where my recordset shows BOF and EOF = true despite
the fact that there is has an actual record (record count = 1). The
count is correct, there should be one record (it shows on the form),
but it is not accessible in the recordset. Does anyone know why this
might be? The code is as follows:
txtSearch is a text box...the code snippet below runs when the user
hits FIND. The forms recordsource uses the search box as part of its
criteria (basically, find records where ID is like txtSearch:
dim RS as recordset
If IsNull(txtSearch) Then
msgbox ("Please enter a search criterium.")
txtSearch.Setfocus
Else
Me.Requery
txtSearch = Null
Set RS = Me.RecordsetClone
msgbox ("RecordSet: " & (RS.BOF And RS.EOF))
msgbox (RS.recordCount)
End If
RESULTS: msgbox1) RecordSet: TRUE
msgbox2) 1
The record will display on the form, but trying to do msgbox(RS(0))
will give an error. What is going on. The table it is searching is a
linked table to a SQL backend, but I don't think this should make a
difference since it is linked.
Thanks,
Ryan