473,395 Members | 2,468 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

How to join 2 different database files?

I'm quite new to VB and need help urgently . I have 2 Access database files
which need to connected/join to each other.

Database file 1 is in c:\dha\ABC.mdb
table: LogAlarm
Work Week | Alarm Address

Database file 2 is in c:\tmt\machine.mdb
table: Alarm
Alarm Address | Alarm Description.

I've got database1 connected to a dbgrid as data1.
I would like to know how to connect it to 2nd database file in order to get
query result as below:

Alarm Address | Alarm Description.

The code I used and didn't really work is as below.

Data1.DatabaseName = "c:\dha\ABC.mdb"

sql= " select LogAlarm.[Alarm Address] , t2.[Alarm Description]"
sql= sql & "from LogAlarm, [Select 'Alarm Address', ' Alarm Description'
from Alarm in 'c:\tmt\machine.mdb]. as t2"
sql= sql & " where LogAlarm.[Alarm Address]=t2.[Alarm Address]
Data1.RecordSource = sql
Data1.Refresh

please help ......rgds rosli


Nov 13 '05 #1
5 7191
On Fri, 30 Sep 2005 09:01:36 +0800, "rosli bakar"
<ro*********@intel.com> wrote:

When you say "dbgrid" I'm thinking you're in a .NET application?
Anyway, it may be better to link a table from db1 to db2 (File / Get
external data / Link table), and then create a query in db1 that
performs the join.
The IN clause you're currently using works in a pure Access
environment, but when called from outside of that, your mileage may
vary.

-Tom.

I'm quite new to VB and need help urgently . I have 2 Access database files
which need to connected/join to each other.

Database file 1 is in c:\dha\ABC.mdb
table: LogAlarm
Work Week | Alarm Address

Database file 2 is in c:\tmt\machine.mdb
table: Alarm
Alarm Address | Alarm Description.

I've got database1 connected to a dbgrid as data1.
I would like to know how to connect it to 2nd database file in order to get
query result as below:

Alarm Address | Alarm Description.

The code I used and didn't really work is as below.

Data1.DatabaseName = "c:\dha\ABC.mdb"

sql= " select LogAlarm.[Alarm Address] , t2.[Alarm Description]"
sql= sql & "from LogAlarm, [Select 'Alarm Address', ' Alarm Description'
from Alarm in 'c:\tmt\machine.mdb]. as t2"
sql= sql & " where LogAlarm.[Alarm Address]=t2.[Alarm Address]
Data1.RecordSource = sql
Data1.Refresh

please help ......rgds rosli



Nov 13 '05 #2
"rosli bakar" <ro*********@intel.com> wrote in message
news:dh**********@news01.intel.com...
I'm quite new to VB and need help urgently . I have 2 Access database
files which need to connected/join to each other.

Database file 1 is in c:\dha\ABC.mdb
table: LogAlarm
Work Week | Alarm Address

Database file 2 is in c:\tmt\machine.mdb
table: Alarm
Alarm Address | Alarm Description.

I've got database1 connected to a dbgrid as data1.
I would like to know how to connect it to 2nd database file in order to
get query result as below:

Alarm Address | Alarm Description.

The code I used and didn't really work is as below.

Data1.DatabaseName = "c:\dha\ABC.mdb"

sql= " select LogAlarm.[Alarm Address] , t2.[Alarm Description]"
sql= sql & "from LogAlarm, [Select 'Alarm Address', ' Alarm Description'
from Alarm in 'c:\tmt\machine.mdb]. as t2"
sql= sql & " where LogAlarm.[Alarm Address]=t2.[Alarm Address]
Data1.RecordSource = sql
Data1.Refresh

Create a 3rd Access-db, use "link tables" to link in each
table from the two other dbs. (or link one table into the
other db).

Now you can JOIN between tables in two different dbs

--
Dag.
Nov 13 '05 #3
z
> Database file 1 is in c:\dha\ABC.mdb
table: LogAlarm
Work Week | Alarm Address

Database file 2 is in c:\tmt\machine.mdb
table: Alarm
Alarm Address | Alarm Description.

I've got database1 connected to a dbgrid as data1.
I would like to know how to connect it to 2nd database file in order to get query result as below:


Try this:

sql= " select LogAlarm.[Alarm Address] , Alarm.[Alarm Description]"
sql= sql & "from LogAlarm, [c:\tmt\machine.mdb].alarm"
sql= sql & " where LogAlarm.[Alarm Address]=Alarm.[Alarm Address]
Data1.Databasename="c:\dma\abc.mdb"
Data1.RecordSource = sql
Data1.Refresh

lp
Zoran
Nov 13 '05 #4
Zoran,

Thanks a lots man....the code works fine now.

rgds rosli
"z" <zo************@vz.htnet.hr> wrote in message
news:dh**********@ss405.t-com.hr...
Database file 1 is in c:\dha\ABC.mdb
table: LogAlarm
Work Week | Alarm Address

Database file 2 is in c:\tmt\machine.mdb
table: Alarm
Alarm Address | Alarm Description.

I've got database1 connected to a dbgrid as data1.
I would like to know how to connect it to 2nd database file in order to

get
query result as below:


Try this:

sql= " select LogAlarm.[Alarm Address] , Alarm.[Alarm Description]"
sql= sql & "from LogAlarm, [c:\tmt\machine.mdb].alarm"
sql= sql & " where LogAlarm.[Alarm Address]=Alarm.[Alarm Address]
Data1.Databasename="c:\dma\abc.mdb"
Data1.RecordSource = sql
Data1.Refresh

lp
Zoran

Nov 13 '05 #5

"z" <zo************@vz.htnet.hr> wrote in message
news:dh**********@ss405.t-com.hr...
Database file 1 is in c:\dha\ABC.mdb
table: LogAlarm
Work Week | Alarm Address

Database file 2 is in c:\tmt\machine.mdb
table: Alarm
Alarm Address | Alarm Description.

I've got database1 connected to a dbgrid as data1.
I would like to know how to connect it to 2nd database file in order to

get
query result as below:


Try this:

sql= " select LogAlarm.[Alarm Address] , Alarm.[Alarm Description]"
sql= sql & "from LogAlarm, [c:\tmt\machine.mdb].alarm"
sql= sql & " where LogAlarm.[Alarm Address]=Alarm.[Alarm Address]
Data1.Databasename="c:\dma\abc.mdb"
Data1.RecordSource = sql
Data1.Refresh

lp
Zoran


It worked fine on above code but when I tried to add another field list and
grouping in the query as below, I would get error
"You tried to execute a query that doesn't include the specified expression
Description as part of an aggregate function. (Error 3122)"

SQL = "Select LogAlarm.[Alarm Address] As Error_Code,"
SQL = SQL & " COUNT(logAlarm.[Alarm Address]) as Freq,"
SQL = SQL & " alarm.[Alarm Description] as Description"
SQL = SQL & " from LogAlarm, [c:\tmt\machine.mdb].alarm"
SQL = SQL & " where logAlarm.[Alarm Address]=alarm.[Alarm Address]"
SQL = SQL & " group by LogAlarm.[Alarm Address]"
SQL = SQL & " order by COUNT(logAlarm.[Alarm Address]) DESC"

please help....rosli

Nov 13 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Pete | last post by:
hello i am a novice at database design and i'm having trouble doing a multi join in mysql, i was able to do a inner join with just the venues and productions tables below like so SELECT...
2
by: Martin | last post by:
I am now working on SQL Server 2000 having had previous experience on a different database. Both of the OUTER JOIN syntaxes is different from what I am used to and I am finding it slightly...
7
by: Newbillian | last post by:
Is there some way of using vba to automate the processe of joining an Access 97 security workgroup? I typed wrkgadm /? at a command prompt and it just opens the gui, so I'm not sure what the...
5
by: jason.evans | last post by:
Hi there. I am having an intrigueing problem. I have a query which left joins another query to itself twice. The original query is derived from a linked table in SQLServer 2000. When I run...
9
by: Fish Womper | last post by:
I am at best a part time developer of Access databases. I use Access 2.0, as this is all my employer has on its computers. Even so, to use this ancient version requires a fairly convoluted...
2
by: zwasdl | last post by:
I'm using access to connect to Oracle via ODBC. I can also connect to Oracle via sql*plus. Can I write a query to join tables from different schema? If so, how? Thanks a million! Wei
3
by: don | last post by:
I have written a program to hold a sales contact db. It is written in c# express. an update is sent from head office in xl format, i need to import only the new rows to an access database. I...
40
by: rdemyan via AccessMonster.com | last post by:
I have two databases, db1 and db2, with the same table, TableA. I want to select the records from TableA in db1 that have a LAST_UPDATE SomeDate. Then I want to get the identical records in TableA...
7
by: dunleav1 | last post by:
I have an application that uses the old join syntax instead of the SQL92 standards join syntax. I need to justify changing the code to the new standard. Is there any performance issue related to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.