query column headings

  • Thread starter Thread starter InventoryQueryGuy
  • Start date Start date
I

InventoryQueryGuy

Hi,

Is it possible to generate a query for column headings in a particular table
so that I can use the results in a combo box?


Thank you.
 
What? Are you attempting to fill a combo box with field names? If so, there
is a RowSourceType that does this for you. If not, you should provide a
better description of what you want.
 
You're right Duane, I wasn't very clear with what I am trying to accomplish.
In the product/service table, I have about 25 columns (which I think you
referred to as fields). Lets say for example some columns are MSPiC, Talent,
Mentoring.
I need a query which returns only results above 4:
SELECT [Employee List].Name
FROM [Employee List] INNER JOIN [Product/Service] ON [Employee List].ID =
[Product/Service].ID
WHERE ((([Product/Service].MSPiC)>4));

So what I would like to do is have a combo box on a form, which
automatically fills with MSPiC, Talent, Mentoring, etc. This value would then
automatically enter into the query WHERE ((([Product/Service].***Combo
Box***)>4));

Any thoughts?
 
My thoughts are that your table structure is not normalized which causes your
issues. If I understand, you are using "MSPiC, Talent, Mentoring,..." as
field names and assigning a numeric value to each. I would change the
structure so that these are values in a field rather than field names.

If you can't change the structure, consider creating a normalizing union
query like:

quniProductServices
===============
SELECT ID, [MSPiC] as Rating, "MSPiC" as Category
FROM [Product/Service]
UNION ALL
SELECT ID, [Talent], "Talent"
FROM [Product/Service]
UNION ALL
SELECT ID, [Mentoring], "Mentoring"
FROM [Product/Service]
UNION ALL
--etc--

Then you could use a query like:
SELECT [Employee List].Name, Rating, Category
FROM [Employee List] INNER JOIN quniProductServices ON [Employee List].ID =
quniProductServices.ID
WHERE quniProductServices.Category = Forms!frmName!cboCategory
AND Rating>4;
 
Thats the one: RowSourceType.
I can't change the table structure and so now I'm looking to run the query
with the result from the combo box.

SELECT [Employee List].Name
FROM [Employee List] INNER JOIN [Product/Service] ON [Employee
List].ID=[Product/Service].ID
WHERE ((([Product/Service].Forms!Form1!Combo4)>4));

So I run the query and it still comes back "Enter Parameter Value."

hmm??


Thanks again.
 
Your solution won't work like you want. As per my other suggestion, change
your table structure.
 
I will take your word for it and give it a go next week.
Thanks for your time! :)



Duane Hookom said:
Your solution won't work like you want. As per my other suggestion, change
your table structure.
--
Duane Hookom
Microsoft Access MVP


InventoryQueryGuy said:
Thats the one: RowSourceType.
I can't change the table structure and so now I'm looking to run the query
with the result from the combo box.

SELECT [Employee List].Name
FROM [Employee List] INNER JOIN [Product/Service] ON [Employee
List].ID=[Product/Service].ID
WHERE ((([Product/Service].Forms!Form1!Combo4)>4));

So I run the query and it still comes back "Enter Parameter Value."

hmm??


Thanks again.
 
Back
Top