does this need a loop statement?

J

jmoore

I hope what I need to do is possible with the database I have. My experience
with VBA is very minimal. The database consists of two related tables, with
6 look-up tables that contain answer possibilities (e.g., 1(yes), 2(no),
3(not avail), 4(not applic), 9(missing)). One table was set up to mimic a
data collection tool, where each variable corresponds to a question on the
tool. I need to produce a report with the total number, and percent, of
responses for each answer option by county. I was able to create a crosstab
query that produces the number of responses for only one question with the
SQL code:

TRANSFORM Count([qReview Sample].ID) AS CountOfID
SELECT [qReview Sample].A1, Count([qReview Sample].ID) AS [Total Of ID]
FROM [qReview Sample]
GROUP BY [qReview Sample].A1
PIVOT [qReview Sample].CNTYNAME;

Now I need to repeat this for each question and calculate the percentage of
each answer option (e.g., number who answered 1 divided by the count of ID).
I am using Access 2003, but the database is 2000 file format. I expect this
needs to be done with looping code, but I don’t know how. I’d love to hear
there is an easier way, but I would be thrilled if it can be done at all.

Your help is greatly appreciated.
 

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