473,385 Members | 1,766 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,385 software developers and data experts.

Joining two tables on two fields

Hello all,

I am joining two tables in a query and the output should be all those
records where two fields in table1 match two corresponding fields in
table2.

I joined the tables using both fields in design view and the Select
statement in SQL view looks good. The query runs perfectly and shows
the result I want but when I save the query and close it, re-opening in
design view shows the error message "Microsoft Office Access can't
represent the join expression {Table1].[Fieldx] = [Table2].[Fieldx] in
design view." This is okay as long as it does not affect the query but
when I run it, I am left with a join on only one of the fields and the
other join (that of Fieldx) is gone.

My trouble is that I am not the only user of this database and someone
might accidentally open this in design view and change my query
unknowingly. Is there a way I can retain the query as using both fields
to join both tables?

Any ideas are very welcome.
Thanks!

Mar 6 '06 #1
3 9266
A 2-field join is quite a common scenario, so there must be another factor
in this as well.

Suggestions:

1. Uncheck the boxes under:
Tools | Options | General | Name AutoCorrect
Explanation of why:
http://allenbrowne.com/bug-03.html

2. Compact the database to get rid of the Name AutoCorrupt junk:
Tools | Database Utilities | Compact

3. Open the 2 tables in design view, and check that the Data Type and Size
of both tables match. For example, the fields are Text type, 50 characters,
then the same field in the other table should ideally be Text, 50 characters
as well.

4. Consider creating a relation between the 2 tables. Choose Relationships
on the Tools menu. Drag Fieldx from Table1 onto Fieldx in Table2. Access
pops up a dialog. Enter the 2nd field on the 2nd row of the dialog to make
the 2 field relation. Check the box for Referential Integrity (RI).

5. Make sure you have the latest service pack for your version of Access and
for JET 4. Both are available from:
http://support.microsoft.com/gp/sp

If you succeeded in matching the field types and sizes, and creating the
relation with enforced RI, and you have JET 4 SP8, Access should have no
problem with the multi-field join in the query.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Reader" <co*********@hotmail.com> wrote in message
news:11**********************@i40g2000cwc.googlegr oups.com...
Hello all,

I am joining two tables in a query and the output should be all those
records where two fields in table1 match two corresponding fields in
table2.

I joined the tables using both fields in design view and the Select
statement in SQL view looks good. The query runs perfectly and shows
the result I want but when I save the query and close it, re-opening in
design view shows the error message "Microsoft Office Access can't
represent the join expression {Table1].[Fieldx] = [Table2].[Fieldx] in
design view." This is okay as long as it does not affect the query but
when I run it, I am left with a join on only one of the fields and the
other join (that of Fieldx) is gone.

My trouble is that I am not the only user of this database and someone
might accidentally open this in design view and change my query
unknowingly. Is there a way I can retain the query as using both fields
to join both tables?

Any ideas are very welcome.
Thanks!

Mar 6 '06 #2
That error message usually occurs when FieldX has been deleted from one of
the tables or FieldX has been renamed in one of the tables. Check your
tables to see if this is the case.

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
Over 1125 users have come to me from the newsgroups requesting help
re******@pcdatasheet.com
"Reader" <co*********@hotmail.com> wrote in message
news:11**********************@i40g2000cwc.googlegr oups.com...
Hello all,

I am joining two tables in a query and the output should be all those
records where two fields in table1 match two corresponding fields in
table2.

I joined the tables using both fields in design view and the Select
statement in SQL view looks good. The query runs perfectly and shows
the result I want but when I save the query and close it, re-opening in
design view shows the error message "Microsoft Office Access can't
represent the join expression {Table1].[Fieldx] = [Table2].[Fieldx] in
design view." This is okay as long as it does not affect the query but
when I run it, I am left with a join on only one of the fields and the
other join (that of Fieldx) is gone.

My trouble is that I am not the only user of this database and someone
might accidentally open this in design view and change my query
unknowingly. Is there a way I can retain the query as using both fields
to join both tables?

Any ideas are very welcome.
Thanks!

Mar 6 '06 #3
"Steve" <no****@nospam.spam> wrote in message
news:6T*************@newsread2.news.atl.earthlink. net...

--
PC Datasheet


To the original poster:

Most people here have a common belief that the newsgroups are for *free
exchange of information*.
But Steve is a notorious job hunter in these groups, always trying to sell
his services.

Before you intend to do business with him look at:
http://home.tiscali.nl/arracom/whoissteve.html

Keith.
Mar 6 '06 #4

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

Similar topics

2
by: James | last post by:
Can anyone please shed some light on the following... I have a framework that uses dynamically created tables, named using an incremental "attribute set ID", as follows: attrdata_1 attrdata_2...
3
by: Andrew | last post by:
Here's my problem: I built a system for data entry and export based on a schema given to my by the state. The output of the data is fixed-width, and a good number of the fields in each row...
1
by: Brian | last post by:
I need help joining info from two tables. Table1 and Table 2 have the same fields(Node,Card,Slot,Facility,Sub-Port,Channel,Group,Cic) Group is text, rest are number. Table 1 contains records for...
1
by: Steve C | last post by:
Hi, I'm having problems constructing a nested join. It's quite complex, so here's a simplfied example of the problem. Any thoughts on what I'm doig wrong - or if I've got the whole approach...
12
by: veaux | last post by:
Question about joins in queries. I have 2 tables with a field called "ID". Table 1 Rec1 = Jan12FredFlintstone Rec2 = Feb01WilmaRubble Table 2 Rec1 = Jan12BarneyRubble Rec2 = Mar03SamSlate
4
by: Rnt6872 | last post by:
Table A Table B BOL# B_BOL# Chargeback# Hi All, I have been struggling with this for...
4
by: herath | last post by:
Is there a way to join 2 tables where the 2 fields on which the tables joined are of different data types(char and varchar)?I tried with CONVERT but is does not give the desired output. My...
2
by: Supermansteel | last post by:
I am joining these 2 tables together in Access 2003 and can't figure out the exact way of writing this script......Can anyone help? I have the following SQL: SELECT...
2
by: Neekos | last post by:
Im working on web tool that will allow supervisors to see a list of their agents and their call stats for a call center. I have one main table that holds employee IDs and their supervisor names....
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.