Difficulty coding a questionair form

C

Cameron

I have a form that has a Tab control on it, and on each page of the tab form
there are a number of questions with yes and no check boxes. The intent of
this form was to be used by the user to record the selections off of an Audit
form. I would like to code the close event on this form so that the event
would loop through each page in the tab and the check marks so that that data
is placed in the tables i have built for the data. What I have been having
trouuble with is how to define th check boxes in code so that the code would
step through each check box, save the ID of the question, the current index
of the tab form and the answer from the tab form. Can check marks be coded so
that they are part of an array so I can step through them.
 
P

Piet Linden

I have a form that has a Tab control on it, and on each page of the tab form
there are a number of questions with yes and no check boxes. The intent of
this form was to be used by the user to record the selections off of an Audit
form. I would like to code the close event on this form so that the event
would loop through each page in the tab and the check marks so that that data
is placed in the tables i have built for the data. What I have been having
trouuble with is how to define th check boxes in code so that the code would
step through each check box, save the ID of the question, the current index
of the tab form and the answer from the tab form. Can check marks be coded so
that they are part of an array so I can step through them.

borrow Duane Hookum's "At Your Survey" and save yourself the headache.
I think it's on Roger Carlson's website.
http://www.rogersaccesslibrary.com/forum/forum_posts.asp?TID=3
 
J

John W. Vinson

I have a form that has a Tab control on it, and on each page of the tab form
there are a number of questions with yes and no check boxes. The intent of
this form was to be used by the user to record the selections off of an Audit
form. I would like to code the close event on this form so that the event
would loop through each page in the tab and the check marks so that that data
is placed in the tables i have built for the data. What I have been having
trouuble with is how to define th check boxes in code so that the code would
step through each check box, save the ID of the question, the current index
of the tab form and the answer from the tab form. Can check marks be coded so
that they are part of an array so I can step through them.

If you don't follow Piet's excellent advice and use a normalized database such
as Duane's At Your Survey, there are a couple of possibilities.

One would be to use a strict naming convention such as naming the checkbox
control for question 31 chk31. You could then loop with code like

Dim QuestionID As Integer
Dim bAns As Boolean
For QuestionID = 1 to 315 <or however many questions you have>
bAns = Me.Controls("chk" & QuestionID).Value
<do something appropriate with the question number and answer>
Next QuestionID

I don't know why you would need the index of the tab form.

Another would be to store the questionID in the checkbox's Tag property and
loop through the form's Controls collection.
 

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