If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Retrieving Records from another database
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 |
#2
|
|||
|
|||
Retrieving Records from another database
...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...90550?v=glance Jay |
Thread Tools | |
Display Modes | |
|
|