Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Database Design / June 2004

Tip: Looking for answers? Try searching our database.

Retrieving Records from another database

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Steven - 18 Jun 2004 17:19 GMT
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
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.