Christine Henderson wrote:[color=blue]
> Dear Brian
>
> Thanks for your suggestion regarding the cominbation of the two fields,
> ie [Receiver Name]= "Ford" AND [Receiver Suburb]= "Melbourne"
>
> My problem is that I do not want to specify a record such as "Ford" and
> "Melbourne" I need to lookup all records from my main table query and
> have the klms travelled returned from the lookup table.
>
> I understand the use of quotes etc and have tried the expression above
> without specifying specific records however I only get the klms for the
> first record in the lookup table.
>
> Is it possible to specify just the field names as the criteria without
> needing = a record.
>
> Thanks for any help available on this problem.
>
> Regards
> Christine
>
>
> *** Sent via Developersdex
http://www.developersdex.com ***[/color]
I'm taking a shot in the dark. The SQL of your query might look
something like:
SELECT Main.[Receiver Name], Main.[Receiver Suburb],
Main.SomeDataField, [Klms Travelled].[Klms Distance] FROM Main INNER
JOIN [Klms Travelled] ON (Main.[Receiver Suburb] = [Klms
Travelled].[Receiver Suburb]) AND (Main.[Receiver Name] = [Klms
Travelled].[Receiver Name]);
Basically, you need to select both tables into the query editor and
link both the [Receiver Name] and [Receiver Suburb] fields. You can
even get fancy by changing the join types by clicking on the lines
joining the two tables. You can show any data from Main along with the
[Klms Distance] for that combination of [Receiver Name] and [Receiver
Suburb].
The way I would actually do it is to use a subquery to gather just the
[Klms Distance] appropriate for that record instead of using the query
you have. Perhaps a little more information about how the [Klms
Distance] is obtained would allow someone to craft an appropriate
subquery.
James A. Fortune