473,789 Members | 3,060 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 9300
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*********@ho tmail.com> wrote in message
news:11******** **************@ i40g2000cwc.goo glegroups.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******@pcdata sheet.com
"Reader" <co*********@ho tmail.com> wrote in message
news:11******** **************@ i40g2000cwc.goo glegroups.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.earth link.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
3510
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 attrdata_3 etc, etc...
3
1707
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 default (never change) for our particular organization. On the db end, to save space, rather than create these columns in the main data tables and simply give them default values for every record, I created a "defaults" table with them. One row,...
1
1921
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 all possible combinations of Node,Card,Slot,Facility,Sub-Port,Channel which indicates a physical port on a piece of equipment. Table 2 is imported from a piece of equipment containing all above info that has an assigned Group and Cic. I want to...
1
6443
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 wrong are welcome. I've two tables :- one is a contact table contacting name, addresses etc. Three of the fields represent users - 'created by', 'last modified by' and 'owner'.
12
5568
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
1564
by: Rnt6872 | last post by:
Table A Table B BOL# B_BOL# Chargeback# Hi All, I have been struggling with this for the past few months. I have two tables that I'm inner joining on BOL#=B_BOL#. This works fine. Now for the problem....When there are chargeback# fields associated with B_BOL# they aren't being captured as additional records. None of my tables
4
11207
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 requirement is to get the minimum (earliest) Posted date along with two other fields.But when i join the two fields I get the duplicate records as well. Following is my query. ...
2
2265
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 PL_Input.Date_ID,Count(PL_Input.+PL_Input.+PL_Input.+PL_Input.+PL_Input.) AS FROM Country INNER JOIN PL_Input ON Country.Country_ID = PL_Input.Country_ID WHERE (((. & "" & . & "" & . & "" & . & "" & .) Like "*2*"))
2
6424
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. I then have a dozen other tables that hold many different employee statistics and scores that they accumulate through the year. These tables all have employee IDs in them, but the IDs would reoccur everyday (so they are not unique) and there is data...
0
9511
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10408
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10199
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10139
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9983
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9020
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6768
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4092
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2909
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.