Welcome to dbFreaks.com!
FAQFAQ      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

Selecting data from two databases

 
   Database Help (Home) -> Visual Basic -> DAO RSS
Next:  Which version of MDAC for DAO 3.51?  
Author Message
Alex Kudrasev

External


Since: Oct 23, 2003
Posts: 2



(Msg. 1) Posted: Thu Oct 23, 2003 7:05 pm
Post subject: Selecting data from two databases
Archived from groups: microsoft>public>vb>database>dao (more info?)

Is it possible to select data from two databases (Access)...?


I've seen examples where SQL becomes
"select database..table.field from database..table"

But how could the syntax be used when DAO makes you use the database
reference when executing the SQL, ie:

dim mydb as database
sqltxt = "select distinct xtitle from reports order by xtitle"
Set mytable = mydb.OpenRecordset(sqltxt, dbOpenDynaset)

Can anybody help???

Thanks,

Alex Kudrasev

 >> Stay informed about: Selecting data from two databases 
Back to top
Login to vote
Jr Mendonça

External


Since: Oct 23, 2003
Posts: 6



(Msg. 2) Posted: Thu Oct 23, 2003 7:05 pm
Post subject: Re: Selecting data from two databases [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

I dont know right, but try to read about database collection
You can "merge" two databases using that
'***
dim mydbs as databases
'***
Try this ok?
See ya.
Jr Mendonça - Brasil.

"Alex Kudrasev" <alexk RemoveThis @art-technology.com.au> escreveu na mensagem
news:ep7RCoSmDHA.964@TK2MSFTNGP10.phx.gbl...
 > Is it possible to select data from two databases (Access)...?
 >
 >
 > I've seen examples where SQL becomes
 > "select database..table.field from database..table"
 >
 > But how could the syntax be used when DAO makes you use the database
 > reference when executing the SQL, ie:
 >
 > dim mydb as database
 > sqltxt = "select distinct xtitle from reports order by xtitle"
 > Set mytable = mydb.OpenRecordset(sqltxt, dbOpenDynaset)
 >
 > Can anybody help???
 >
 > Thanks,
 >
 > Alex Kudrasev
 >
 >
 ><!-- ~MESSAGE_AFTER~ -->

 >> Stay informed about: Selecting data from two databases 
Back to top
Login to vote
Jr Mendonça

External


Since: Oct 23, 2003
Posts: 6



(Msg. 3) Posted: Thu Oct 23, 2003 7:05 pm
Post subject: Re: Selecting data from two databases [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Can I make a question?
Why are you using 2 MS.Access databases? Why dont you merge it?
I haved bad experiencies with this behavior.
Think about ok? This is only a sugestion.
"Alex Kudrasev" <alexk DeleteThis @art-technology.com.au> escreveu na mensagem
news:ep7RCoSmDHA.964@TK2MSFTNGP10.phx.gbl...
 > Is it possible to select data from two databases (Access)...?
 >
 >
 > I've seen examples where SQL becomes
 > "select database..table.field from database..table"
 >
 > But how could the syntax be used when DAO makes you use the database
 > reference when executing the SQL, ie:
 >
 > dim mydb as database
 > sqltxt = "select distinct xtitle from reports order by xtitle"
 > Set mytable = mydb.OpenRecordset(sqltxt, dbOpenDynaset)
 >
 > Can anybody help???
 >
 > Thanks,
 >
 > Alex Kudrasev
 >
 >
 ><!-- ~MESSAGE_AFTER~ -->
 >> Stay informed about: Selecting data from two databases 
Back to top
Login to vote
Douglas J. Steele

External


Since: Mar 14, 2004
Posts: 1626



(Msg. 4) Posted: Thu Oct 23, 2003 7:28 pm
Post subject: Re: Selecting data from two databases [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

The easiest way would be to have a linked table in database 1 that points to
the table in database 2, and then simply query database 1.

If you don't want to do this, you can query from one database to a table in
another database using:

SELECT CustomerID
FROM Customers
IN OtherDB.mdb
WHERE CustomerID Like "A*";


I haven't tried, but I would assume you could extend this to:

SELECT Customers.CustomerID, Invoices.InvoiceID
FROM Customers
IN OtherDB.mdb
INNER JOIN Invoices
ON Customers.CustomerID = Invoices.CustomerID
WHERE Customers.CustomerID Like "A*";




--
Doug Steele, Microsoft Access MVP
<a style='text-decoration: underline;' href="http://I.Am/DougSteele" target="_blank">http://I.Am/DougSteele</a>
(No private e-mails, please)



"Alex Kudrasev" <alexk DeleteThis @art-technology.com.au> wrote in message
news:ep7RCoSmDHA.964@TK2MSFTNGP10.phx.gbl...
 > Is it possible to select data from two databases (Access)...?
 >
 >
 > I've seen examples where SQL becomes
 > "select database..table.field from database..table"
 >
 > But how could the syntax be used when DAO makes you use the database
 > reference when executing the SQL, ie:
 >
 > dim mydb as database
 > sqltxt = "select distinct xtitle from reports order by xtitle"
 > Set mytable = mydb.OpenRecordset(sqltxt, dbOpenDynaset)
 >
 > Can anybody help???
 >
 > Thanks,
 >
 > Alex Kudrasev
 >
 >
 ><!-- ~MESSAGE_AFTER~ -->
 >> Stay informed about: Selecting data from two databases 
Back to top
Login to vote
Raymond Chiu2

External


Since: Oct 20, 2003
Posts: 4



(Msg. 5) Posted: Thu Oct 23, 2003 10:31 pm
Post subject: Re: Selecting data from two databases [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

You may try to link a table in one of the databases and it'll do the trick.
raymond

"Alex Kudrasev" <alexk RemoveThis @art-technology.com.au> wrote in message
news:ep7RCoSmDHA.964@TK2MSFTNGP10.phx.gbl...
 > Is it possible to select data from two databases (Access)...?
 >
 >
 > I've seen examples where SQL becomes
 > "select database..table.field from database..table"
 >
 > But how could the syntax be used when DAO makes you use the database
 > reference when executing the SQL, ie:
 >
 > dim mydb as database
 > sqltxt = "select distinct xtitle from reports order by xtitle"
 > Set mytable = mydb.OpenRecordset(sqltxt, dbOpenDynaset)
 >
 > Can anybody help???
 >
 > Thanks,
 >
 > Alex Kudrasev
 >
 >
 ><!-- ~MESSAGE_AFTER~ -->
 >> Stay informed about: Selecting data from two databases 
Back to top
Login to vote
Alex Kudrasev

External


Since: Oct 23, 2003
Posts: 2



(Msg. 6) Posted: Fri Oct 24, 2003 1:02 am
Post subject: Re: Selecting data from two databases [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Except...linking a table will lock in the path of the linked database. So -
can't use that if distributing the application...!

Alex Kudrasev.

Raymond Chiu <rayswchiuUNOTINVALID RemoveThis @netvigator.com> wrote in message
news:eMDMDlVmDHA.2216@TK2MSFTNGP12.phx.gbl...
 > You may try to link a table in one of the databases and it'll do the
trick.
 > raymond
 >
 > "Alex Kudrasev" <alexk RemoveThis @art-technology.com.au> wrote in message
 > news:ep7RCoSmDHA.964@TK2MSFTNGP10.phx.gbl...
  > > Is it possible to select data from two databases (Access)...?
  > >
  > >
  > > I've seen examples where SQL becomes
  > > "select database..table.field from database..table"
  > >
  > > But how could the syntax be used when DAO makes you use the database
  > > reference when executing the SQL, ie:
  > >
  > > dim mydb as database
  > > sqltxt = "select distinct xtitle from reports order by xtitle"
  > > Set mytable = mydb.OpenRecordset(sqltxt, dbOpenDynaset)
  > >
  > > Can anybody help???
  > >
  > > Thanks,
  > >
  > > Alex Kudrasev
  > >
  > >
  > >
 >
 ><!-- ~MESSAGE_AFTER~ -->
 >> Stay informed about: Selecting data from two databases 
Back to top
Login to vote
João Araújo

External


Since: Nov 08, 2003
Posts: 2



(Msg. 7) Posted: Sat Nov 08, 2003 10:52 pm
Post subject: Re: Selecting data from two databases [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Hi Alex!
I use something like that:
sqltxt="SELECT field1, Field2 FROM `C:\OTHERDB.MDB`.Table1 ORDER BY Field2"
Note that the char ` is ASCII 96.
If you have a password protect database use as follow:
sqltxt="SELECT field1, Field2 FROM
`C:\OTHERDB.MDB;USER=Admin;Password=mypass`.Table1 ORDER BY Field2"

Hope be helpful.
João Araújo

"Alex Kudrasev" <alexk.DeleteThis@art-technology.com.au> wrote in message
news:ep7RCoSmDHA.964@TK2MSFTNGP10.phx.gbl...
 > Is it possible to select data from two databases (Access)...?
 >
 >
 > I've seen examples where SQL becomes
 > "select database..table.field from database..table"
 >
 > But how could the syntax be used when DAO makes you use the database
 > reference when executing the SQL, ie:
 >
 > dim mydb as database
 > sqltxt = "select distinct xtitle from reports order by xtitle"
 > Set mytable = mydb.OpenRecordset(sqltxt, dbOpenDynaset)
 >
 > Can anybody help???
 >
 > Thanks,
 >
 > Alex Kudrasev
 >
 >
 ><!-- ~MESSAGE_AFTER~ -->
 >> Stay informed about: Selecting data from two databases 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
Data Source - Data Report Designer - Is there a way to change the Database Source at run time in the Microsoft Data Report Designer? If so. How?

Can't Make Data Connection - I'm getting a bit frustrated. 1) I want to evaluate Access 2007 Beta but can't install it and posting the question concerning this produces no rewsponse from these geniuses. 2) Going to abandon Access 2003 and use some other database or programming..

Strange Data Control problem - Hi all, if anyone can shed some light on this I'd be very happy! I have an large application which uses the DAO version that is loaded on the users system (normally 3.6). There are currently over 300 users of the application and it would appear that....

Using Jet data control to write numbers to an excel spread.. - Hi, I'm currently using the vb data controls to write numbers to excel spreadsheets using the Jet driver. Unfortunately, even though the data being sent to the spreadsheet is numbers, excel has a nasty habit of showing them as text, requiring them t...

Connect Data Control to Access 97 secured DB via MDW file .. - Re VB 6.0 & Access 97 I am using the MS Data Control on a form which I need to refresh each time the user enters criteria. The DB is secured via an MDW file. Could someone please provide an example, using DAO, with a solution to connect the Data..
   Database Help (Home) -> Visual Basic -> DAO All times are: Pacific Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]