Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Other Forums
 MS Access
 Searching Access Database

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2000-12-04 : 08:53:50
Josh writes "I have muliple tables in database batabase.mdb. I need to search all of those tables for a recordset with field name "username" matching the value "josh". If that is found, I then need to get the value of the field "password" to a variable.

The conditions may be met or they may not. In other words, i need to be able to handle it if username "josh" could not be found in any recordset.

This gives error:

objRec2.open "ugly", strConnect, adOpenKeyset, adLockReadOnly, adCmdTable
objRec2.MoveFirst
Do While Not objRec2.EOF And objRec2("username")<>givenusername
if objRec2("password")= givenpassword then
found=true
end if
objrec2.MoveNext
loop

and i don't even like using loops like this because it doesn't stop when the conditiosn are met:

objRec2.MoveFirst
while NOT objRec2.EOF
if objRec2("username")=username then
if objRec2("password")= password then
found=true
end if
end if
objrec2.movenext
wend


i will be searching several thousand records. That's why i broke the database up in to tables...to lessen search time. I may be wrong in my logic. Any help?
"
   

- Advertisement -