M
Martin
Hi,
I'm using Access 2003. I have a grades Dbase to keep track of student
grades. I have quizzes, written tests and performance exams to keep track
of. My problem is the written exam. Over 10 different lessons, the written
exams range from 10 questions to 70 question. I would like to write code
that hides the unused fields if greater than the number of questions ask. To
be flexable, I don't want to hard code for just the 10 lessons. I do have a
table that holds the number of questions.
Is there a way to cycle through the different question fields and hide then?
Here is how I am doing it that works and what I am trying to reduce.
iwritten = myset!WXMax 'WXMax = number of questions per exam.
If iwritten >= 1 Then
Me.Q1A = mysetwa![Q1]
Me.Q1A.Visible = True
Else
Me.Q1A.Visible = False
End If
If iwritten >= 2 Then
Me.Q2A = mysetwa![Q2]
Me.Q2A.Visible = True
Else
Me.Q2A.Visible = False
End If
etc. up to question 70
would just like to us a For loop to do the job but having trouble
referencing the controls for question 1, 'Q1', to 70, 'Q70".
iwritten = myset!WXMax
For x = 1 To iwritten
If iwritten >= x Then
me.Controls!.Q & x & A = mysetwa![Q & x & ] 'does not like
endif
Next x
I'm using Access 2003. I have a grades Dbase to keep track of student
grades. I have quizzes, written tests and performance exams to keep track
of. My problem is the written exam. Over 10 different lessons, the written
exams range from 10 questions to 70 question. I would like to write code
that hides the unused fields if greater than the number of questions ask. To
be flexable, I don't want to hard code for just the 10 lessons. I do have a
table that holds the number of questions.
Is there a way to cycle through the different question fields and hide then?
Here is how I am doing it that works and what I am trying to reduce.
iwritten = myset!WXMax 'WXMax = number of questions per exam.
If iwritten >= 1 Then
Me.Q1A = mysetwa![Q1]
Me.Q1A.Visible = True
Else
Me.Q1A.Visible = False
End If
If iwritten >= 2 Then
Me.Q2A = mysetwa![Q2]
Me.Q2A.Visible = True
Else
Me.Q2A.Visible = False
End If
etc. up to question 70
would just like to us a For loop to do the job but having trouble
referencing the controls for question 1, 'Q1', to 70, 'Q70".
iwritten = myset!WXMax
For x = 1 To iwritten
If iwritten >= x Then
me.Controls!.Q & x & A = mysetwa![Q & x & ] 'does not like
endif
Next x