Solved

ADO database searching

Posted on 2001-06-10
3
166 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 50 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
With User Account Control (UAC) enabled in Windows 7, one needs to open an elevated Command Prompt in order to run scripts under administrative privileges. Although the elevated Command Prompt accomplishes the task, the question How to run as script…
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…

695 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