Solved

ADO database searching

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

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

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

Suggested Solutions

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

832 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