Search a recordset

prgwhiting

Registered User.
Local time
Today, 22:43
Joined
Apr 18, 2000
Messages
15
OK, OK I know this is easy. I've even done it myself before, but I can't remember the code for it. I have a very small number of users, around 5. I've got a table called TBLUSERS which holds various information such as Their Direct line number etc, and their login names. What I'm getting at here, is that I want to search the recordset in code in Access 97. Like I've said I've done it before, but I can't remember. When I do rst.FindFirst etc. it just finds me the record that is the first one, regardless of the criteria I put in. Please help. The purpose of this... as a sideline topic, is that I'm trying to keep tabs of whose using the database at any one moment. In the Users table I've put a Yes/No field which is checked when their on, unchecked when their not. This is run from the main form which is always open, (I've never really liked switchboards.) Currently I've got an Update query running in SQL to do the business. Only I imagine it's going to work a mite faster if I do it with a rst.FindFirst. Well them's the facts, please can someone remind me how to find records via code, and also if you know tell me which is the quickest way to do this ie. sql or rst.FindFirst or whatever. Thank You
 
A snippet of code that I use:
dim db as database
dim rst as recordset
set db=currentdb
set rst=db.openrecordset("tblusers")
rst.findfirst "[fieldname]='" & me!txtfield & "'"
if rst.nomatch=false then
me.bookmark=rst.bookmark
 
Thanks a lot, worked a charm. I'll keep a copy of this, this time.
 

Users who are viewing this thread

Back
Top Bottom