A Microsoft Office (Excel, Word) forum. OfficeFrustration

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.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Database Design
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Retrieving Records from another database



 
 
Thread Tools Display Modes
  #1  
Old June 18th, 2004, 05:19 PM
Steven
external usenet poster
 
Posts: n/a
Default 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  
Old June 19th, 2004, 05:27 AM
Jay Vinton
external usenet poster
 
Posts: n/a
Default 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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 01:52 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.