I want to view the records in another(ie. history)
database.
I am doing something like this currently out of my main
database.
Dim db As DAO.Database
Dim ws As DAO.Workspace
Dim rst As DAO.Recordset
Set ws = DBEngine.Workspaces(0)
Set db = ws.OpenDatabase("PathAndFileName", False,
False, "MS Access;PWD=" & VARPassword)
Set rst = db.OpenRecordset("TableName", dbOpenDynaset)
----Problem is here---
I can edit change update delete.....with the record set in
the other(ie history) database...but I cant figure how
to "SELECT" the records to view in a query.
How is this done? Thank you for your help.
Steven
Jay Vinton - 19 Jun 2004 05:27 GMT
> ...but I cant figure how
> to "SELECT" the records to view in a query.
Hi Steven,
If your table is named "Customers" and you want to get all columns, then
.OpenRecordset("Customers") is the same as a SQL query, such as
.OpenRecordset("Select * from Customers")
If you want to limit the number of columns returned, use
.OpenRecordset("Select FirstName, LastName From Customers")
If you want to limit the number of rows returned, use
.OpenRecordset("Select * From Customers Where City = 'New York' ")
A good book for learning SQL is
http://www.amazon.com/exec/obidos/tg/detail/-/0201447878/102-9117917-3990550?v=glance
Jay