Set DB1 = DBEngine.OpenDatabase("C:\DataFolder\DataDB.mdb")
Sql = "SELECT * FROM TABLE1 WHERE INDEX = 1432;"
Set rs1 = DB1.OpenRecordset(Sql)
I am no closer now that I was at 6 AM this morning. I really need some help!
I can access the database and read/write data to it but cannot find the way to create and excecute the Sql statement so I access
Thanks
Dick Roose

Dynamic queries on Access databases
code-breaker
Ok, here is a trick I learned on how to obtain a connection string for your database connection:
1. create a .txt file in windows explorer.
2. rename it to .udl.
3. Open it, it should display the Data Link Properties Dialog
4. Select the Microsoft Jet x.x OLE DB Provider in the list
5. Click next and specify the .mdb location.
6. Close and save the changes.
7. Open the .udl file with notepad.
8. Copy the generated connection string "except the line that starts with ;
9. past this as a connection string in your code...
cheers,
Paul June A. Domag
FrankBru
Could not find installable ISAM.
I then spent a couple of hours trying to resolve this issue and I am about to give up. It seems that Microsoft.Jet.Oledb.4.0 requires the Msrd4x40.dll or an equivalent file which I cannot find anywhere. The Msrd3x40.dll file works for jet 3 but doesn't work for jet 4.
Any suggestions on what I do now
Thanks
Dick Roose
Wessty
Your 3 line statements there is equivalent to:
Imports System.Data.OleDb
Dim constr as String = "Provider=Microsoft.Jet.Oledb.4.0; Data Source=<mdb path>"
Dim conn as new OleDbConnection(constr)
Dim dt as new DataTable()
Dim cmd as new OleDbCommand("<your sql statement>", conn)
conn.Open()
Dim dr as OleDbDataReader = cmd.ExecuteReader();
dt.Load(dr);
your datatable now contains your queried data...
BTW, don't forget to dispose and close the objects after using. To avoid resource leaks...
cheers,
Paul June A. Domag