PC Review


Reply
Thread Tools Rate Thread

Distinct Field and Record Query

 
 
okiebob
Guest
Posts: n/a
 
      8th Jun 2009
Good morning, I'm trying to execute a query that is based on a field within
the same record.
Example; Field A has a value selected and with the relationships that have
been established in background tables, Field B will execute a query that
limits the list in a combo box to those values associated with Field A. Both
of these are within the same record of a table.

While I've been able to have the query execute properly if Field A only has
one value, I have not been able to get it to execute properly if Field A has
more than 1 value (effectively coming back with the values for everything in
Field A instead of those exclusive to that record).

I'm hoping some of you might be able to tell me what commands need to be
included to execute properly.

Thanks in advance
 
Reply With Quote
 
 
 
 
Stewart Berman
Guest
Posts: n/a
 
      9th Jun 2009
Lacking the code and SQl one can only guess. My guess is that the way you have setup the query for
field B the results is based on the current value of field A.

If this is not the reason please provide some additional information -- like the queries that
populate field A and field B.


okiebob <(E-Mail Removed)> wrote:

>Good morning, I'm trying to execute a query that is based on a field within
>the same record.
>Example; Field A has a value selected and with the relationships that have
>been established in background tables, Field B will execute a query that
>limits the list in a combo box to those values associated with Field A. Both
>of these are within the same record of a table.
>
>While I've been able to have the query execute properly if Field A only has
>one value, I have not been able to get it to execute properly if Field A has
>more than 1 value (effectively coming back with the values for everything in
>Field A instead of those exclusive to that record).
>
>I'm hoping some of you might be able to tell me what commands need to be
>included to execute properly.
>
>Thanks in advance


 
Reply With Quote
 
okiebob
Guest
Posts: n/a
 
      9th Jun 2009
That is correct. The query is based on the values in Field A (Weapon
System/Commodity). Below is the sql:

SELECT DISTINCT [Comm Loc Level].Location
FROM [Comm Loc Level] INNER JOIN [Equipment Types] ON [Comm Loc
Level].[Weapon System/Commodity] = [Equipment Types].[Weapon
System/Commodity];

I have tried adding the additional WHERE statement but because I can't
figure out how to direct the query to only search for values associted with
Field A (Weapon System/Commodity) in each specific row, it adds no useful
criteria.

WHERE ((([Equipment Types].[Weapon System/Commodity]) = [Comm Loc
Level].[Weapon System/Commodity]))

Thanks again for the help


"Stewart Berman" wrote:

> Lacking the code and SQl one can only guess. My guess is that the way you have setup the query for
> field B the results is based on the current value of field A.
>
> If this is not the reason please provide some additional information -- like the queries that
> populate field A and field B.
>
>
> okiebob <(E-Mail Removed)> wrote:
>
> >Good morning, I'm trying to execute a query that is based on a field within
> >the same record.
> >Example; Field A has a value selected and with the relationships that have
> >been established in background tables, Field B will execute a query that
> >limits the list in a combo box to those values associated with Field A. Both
> >of these are within the same record of a table.
> >
> >While I've been able to have the query execute properly if Field A only has
> >one value, I have not been able to get it to execute properly if Field A has
> >more than 1 value (effectively coming back with the values for everything in
> >Field A instead of those exclusive to that record).
> >
> >I'm hoping some of you might be able to tell me what commands need to be
> >included to execute properly.
> >
> >Thanks in advance

>
>

 
Reply With Quote
 
Stewart Berman
Guest
Posts: n/a
 
      11th Jun 2009
Are you using Access 2007 with multivalued fields? If so you need to add .value the multivalued
field name to get individual values.

okiebob <(E-Mail Removed)> wrote:

>That is correct. The query is based on the values in Field A (Weapon
>System/Commodity). Below is the sql:
>
>SELECT DISTINCT [Comm Loc Level].Location
>FROM [Comm Loc Level] INNER JOIN [Equipment Types] ON [Comm Loc
>Level].[Weapon System/Commodity] = [Equipment Types].[Weapon
>System/Commodity];
>
>I have tried adding the additional WHERE statement but because I can't
>figure out how to direct the query to only search for values associted with
>Field A (Weapon System/Commodity) in each specific row, it adds no useful
>criteria.
>
>WHERE ((([Equipment Types].[Weapon System/Commodity]) = [Comm Loc
>Level].[Weapon System/Commodity]))
>
>Thanks again for the help
>
>
>"Stewart Berman" wrote:
>
>> Lacking the code and SQl one can only guess. My guess is that the way you have setup the query for
>> field B the results is based on the current value of field A.
>>
>> If this is not the reason please provide some additional information -- like the queries that
>> populate field A and field B.
>>
>>
>> okiebob <(E-Mail Removed)> wrote:
>>
>> >Good morning, I'm trying to execute a query that is based on a field within
>> >the same record.
>> >Example; Field A has a value selected and with the relationships that have
>> >been established in background tables, Field B will execute a query that
>> >limits the list in a combo box to those values associated with Field A. Both
>> >of these are within the same record of a table.
>> >
>> >While I've been able to have the query execute properly if Field A only has
>> >one value, I have not been able to get it to execute properly if Field A has
>> >more than 1 value (effectively coming back with the values for everything in
>> >Field A instead of those exclusive to that record).
>> >
>> >I'm hoping some of you might be able to tell me what commands need to be
>> >included to execute properly.
>> >
>> >Thanks in advance

>>
>>


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Access 97 Query Involving Selecting Distinct Field Values =?Utf-8?B?SmFtZXMgU2ltcHNvbg==?= Microsoft Access Queries 3 6th Aug 2006 04:56 PM
Distinct Record Query selgin Microsoft Access Queries 3 1st Apr 2005 02:59 AM
Distinct Query, on one field with return on multiple fields Bob Microsoft Access Form Coding 9 15th Jun 2004 10:32 PM
distinct query with record count Starbuck Microsoft Access 4 19th Oct 2003 06:52 PM
Query with Distinct on one field only JohnFol Microsoft Access Queries 1 1st Aug 2003 11:55 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:00 PM.