querrying for a specific field

  • Thread starter Thread starter Bill Pratt
  • Start date Start date
B

Bill Pratt

I am just beginning with Access but have gotten accustomed
to the basics really quick. I am working on a database
that has 25-30 fields, many of which are yes/no fields. I
have worked with queries and can do a simple parameter
query to find all records who have a specific criteria in
a specific field column but I would like to expand this
concept. Is there a way to easily "request" the field
name (like a parameter query) when a report is run or a
query is run and have the database look for that field and
then look for the criteria? Example: There are 5 fields
A, B, C, D, E. They are all yes/no fields. I would like
to be prompted as to which field I want to look in and
then have a quick way to get all of the records who have a
yes under that column? Can the query prompt me as to what
field I want to look in? Say, "Enter field". I would
enter C. The query would then look in field C and report
back to me the yes's.

With the 25-30 fields I have in my database, setting up 25-
30 queries and then the corresponding reports will take a
long time and I was trying to find an easier way.
 
Bill

Your description makes it sound like you are using a spreadsheet (multiple,
repeating Y/N columns). This is not an efficient way to structure your
tables in Access, and makes certain tasks quite difficult. You may wish to
review the topic of normalization, which will, in turn, make using Access'
strengths and tools much easier.

For example, instead of multiple fields, each of which represents a Y/N
answer, you could create a table that holds a minimum of three fields. Each
row would need a way to identify who answered, what (question) was answered,
and what the answer was. One example would be something like:

trelResponse
AnswererID
QuestionID
Answer

This will give you much greater flexibility in querying and building
reports.
 
Back
Top