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 » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Double references in a query



 
 
Thread Tools Display Modes
  #1  
Old July 29th, 2006, 06:49 PM posted to microsoft.public.access.queries
Rolf Rosenquist
external usenet poster
 
Posts: 14
Default Double references in a query

I have one table for vendors, one for customers and one for countries among
others. The two first have a field "countryNo" and the forms have references
to the country table via combo boxes for registering the addresses. It works
as intended for both tables.

In a query I want to get the fields for both the vendors and the customers
addresses together with orders. The addresses are written one by one and
they show up as expected, but when I use the country table to get the
countries I cannot get them properly.

Is there a way to tell the query that with the vendors country number it
should write the vendors country and with the customers country number show
the customers country?

/ Rolf


  #2  
Old July 29th, 2006, 08:09 PM posted to microsoft.public.access.queries
Douglas J. Steele
external usenet poster
 
Posts: 9,313
Default Double references in a query

You need to refer to the country table twice in your query, joining one
instance to Vendor, and the other to Customer.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)


"Rolf Rosenquist" wrote in message
...
I have one table for vendors, one for customers and one for countries among
others. The two first have a field "countryNo" and the forms have
references
to the country table via combo boxes for registering the addresses. It
works
as intended for both tables.

In a query I want to get the fields for both the vendors and the customers
addresses together with orders. The addresses are written one by one and
they show up as expected, but when I use the country table to get the
countries I cannot get them properly.

Is there a way to tell the query that with the vendors country number it
should write the vendors country and with the customers country number
show
the customers country?

/ Rolf




  #3  
Old July 29th, 2006, 08:19 PM posted to microsoft.public.access.queries
Marshall Barton
external usenet poster
 
Posts: 5,361
Default Double references in a query

Rolf Rosenquist wrote:

I have one table for vendors, one for customers and one for countries among
others. The two first have a field "countryNo" and the forms have references
to the country table via combo boxes for registering the addresses. It works
as intended for both tables.

In a query I want to get the fields for both the vendors and the customers
addresses together with orders. The addresses are written one by one and
they show up as expected, but when I use the country table to get the
countries I cannot get them properly.

Is there a way to tell the query that with the vendors country number it
should write the vendors country and with the customers country number show
the customers country?



Add the Countries table to the query twice. The second copy
will be named something like Countries_1.

Now, drag the vendor countryNo field to its counterpart in
the Countries table and drag customers table's countryNo
field to its counterpart in the Countries_1 table.

Make usre there are no extraneous connecting lines left over
from Access' attempts to make this automatic.

--
Marsh
MVP [MS Access]
  #4  
Old July 29th, 2006, 09:51 PM posted to microsoft.public.access.queries
Rolf Rosenquist
external usenet poster
 
Posts: 14
Default Double references in a query

Thanks for the instructions that made it work !
/ Rolf


"Marshall Barton" skrev i meddelandet
...
Rolf Rosenquist wrote:

I have one table for vendors, one for customers and one for countries

among
others. The two first have a field "countryNo" and the forms have

references
to the country table via combo boxes for registering the addresses. It

works
as intended for both tables.

In a query I want to get the fields for both the vendors and the

customers
addresses together with orders. The addresses are written one by one and
they show up as expected, but when I use the country table to get the
countries I cannot get them properly.

Is there a way to tell the query that with the vendors country number it
should write the vendors country and with the customers country number

show
the customers country?



Add the Countries table to the query twice. The second copy
will be named something like Countries_1.

Now, drag the vendor countryNo field to its counterpart in
the Countries table and drag customers table's countryNo
field to its counterpart in the Countries_1 table.

Make usre there are no extraneous connecting lines left over
from Access' attempts to make this automatic.

--
Marsh
MVP [MS Access]



 




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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Access shuts down, when i try to save this query Dann Running & Setting Up Queries 12 February 3rd, 2006 02:49 AM
Toolbars, Drop-Down Menus Rick New Users 1 September 21st, 2005 11:17 AM
Error when running Query, but not Report Blaze Running & Setting Up Queries 29 September 9th, 2005 05:40 AM
Here's a shocker Mike Labosh General Discussion 2 October 26th, 2004 05:04 PM
Union Query Not Returning A Value Jeff G Running & Setting Up Queries 2 October 19th, 2004 05:47 PM


All times are GMT +1. The time now is 10:44 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.