Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Check successful query

Status
Not open for further replies.

boborsipho

Programmer
Sep 6, 2002
14
ZA
How do I check in VBA/Access (if it is possible in Access) that a update query actually updated something and then use the fact that it updated/not.

I've got a log in form that checks if the username & password is valid, and then Activates the use, if found in the table, as Yes (Activates is a flag). I want the form to close if the user was found, or the system should close if the user was not found.

Thanks
Bob
 
Sounds like the easiest why to do this would be to check for EOF or BOF before setting the user as active.. IF there's a user then EOF or BOF will be False.. IF the users isn't there.. then EOF or BOF will be set to true

Something like:

Query = "Select User From TBL_Users"
Rs.Open Query, Conn

IF RS.BOF OR RS.EOF THEN
'// User wasn't found..
'// And code here to handle it
ELSE
'// Ok, user was found
'// Set to Active, and what ever else
END IF
The PogoWolf
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top