Query a table's particular column and return the field name.

I

InventoryQueryGuy

It is possible to retrieve the field names from a query whereby I choose
which row to analyze (eventually from a combo box on a form) and return the
result(s) when above 4?
For example in the table below, I can choose BP as the Product/Service, then
my result would be Name1 and Name3.

prodserv tbl
ID Product/Service Name1 Name2 Name3 Name4
1 MPiC 4 2 7 1
2 BP 6 3 5 2
3 Leadership 3 2 1 3

Is this even possible, or should I have a separate table and query for each
Product/Service (there are ~50 of them!). If this is possible, what would the
SQL look like?

-Thanks.
 
K

KARL DEWEY

Your data should look like this --
ID Product/Service Name
1 MPiC 4
2 MPiC 2
3 MPiC 7
4 MPiC 1
5 BP 6
6 BP 3
7 BP 5
8 BP 2
Of course your field should not be titled 'Name' as that is a reserved word
in Access and may give you problems.
 
B

Bob Barrows

KARL said:
Your data should look like this --
ID Product/Service Name
1 MPiC 4
2 MPiC 2
3 MPiC 7
4 MPiC 1
5 BP 6
6 BP 3
7 BP 5
8 BP 2
Of course your field should not be titled 'Name' as that is a
reserved word in Access and may give you problems.

Shouldn't it be more like this?

ID Product/Service Name Value
1 MPiC Name1 4
2 MPiC Name2 2
3 MPiC Name3 7
4 MPiC Name4 1
5 BP Name1 6
6 BP Name2 3
7 BP Name3 5
8 BP Name4 2

again, with the proviso that both "name" and "value" are reserved
keywords and should not be used for field namds ...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top