?
Solved

ADO database searching

Posted on 2001-06-10
3
Medium Priority
?
167 Views
Last Modified: 2013-11-13
I am using MS ADO 2.6 and I want to know how do I search a column for a certain entry.  I have a table called UserLog with columns called: Name, Date, Time.  The Name column has an index called PrimaryKey to prevent multiple entries.  How do I search the Name column for an entry called John Doe and will find it fast(I have a lot of entries in the database)?

This is my code to connect to the database:

Private Sub Command1_Click
Dim ILConnect As New ADODB.Connection
Dim ILRecordset As New ADODB.Recordset
ILConnect.Open "Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False;Data Source=C:\windows\desktop\dfd.mdb"
ILRecordset.LockType = adLockPessimistic
ILRecordset.Open "UserLog", ILConnect, , , adCmdTable
End Sub
0
Comment
Question by:vpl4
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 6

Accepted Solution

by:
JonFish85 earned 200 total points
ID: 6174797
ILRecordset.Execute "SELECT * FROM TableName WHERE name='John Doe'"
ILRecordset.Refresh
Try that
0
 

Expert Comment

by:qazafiq
ID: 6175975
First of all if your planning to use ACCESS database only then there is nothing better than DAO.

Anyway thats just a thought, but do you really want to be going to the database everytime you make a search?

I dont think that would be a wise thing to do. Why dont we open a recordset containg all the data of the table, yes it would take long the first time it opens but after that all we need to do is filter our recordset. This would be alot faster.
0
 

Author Comment

by:vpl4
ID: 6179749
I think I submitted the question twice but got two different answers.  They both work and they give me two options to choose from.  Thanks for your assistance.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Monitor input from a computer is usually nothing special.  In this instance it prevented anyone from using the computer.  This was a preconfiguration that didn't work.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question