R
Red via AccessMonster.com
Good Day all,
I am trying to write code behind a questionair. As you will be able to tell,
I am very unexperienced at writing code so please bare with me (and laugh at
my code :>) ) but not to my expectation I cant get it to run. Here is my
problem.
I have a questionaire that has yes/no answers. On two occasions if the
answere is yes, this brings up a set of sub-questions relating to that
question. The questions are stored in a table as is the answers stored in a
table with the questionID as the PK.
I have included my code so far (which doesn't work :<( ) . Can anyone take a
look at it and give me some guidance on where I'm going wrong? Question 708
and 785 are the two questions that have sub-questions if answered yes. If I
need to provide more information please let me know that as well.
(I tried to write code in two different ways but no good.)
Thanks in advance for you assistance.
VR,
Red
Private Sub Command22_Click()
'next Question Button
Dim rst As DAO.Recordset
Set rst = Me.RecordsetClone
rst.Bookmark = Me.Bookmark
On Error GoTo Err_Command22_Click
'question has sub questions if answered "yes"
If Me.QuestionID = 708 And True Then
DoCmd.GoToRecord , , acNext
Else
Recordset.moveto QuestionID = 785, , acNext
End If
If Me.QuestionID = 785 And True Then
DoCmd.GoToRecord , , acNext
Else
GoToQuestionID = 710, , acNext
End If
' question has sub questions if answered "yes"
'If Me.QuestionID = 785 And Yes Then
'DoCmd.GoToRecord 786 - 789
' Else
' DoCmd.GoToRecord , , acNext
Err_Command22_Click:
MsgBox "You've Reached The End Of The Review"
'End If
End Sub
I am trying to write code behind a questionair. As you will be able to tell,
I am very unexperienced at writing code so please bare with me (and laugh at
my code :>) ) but not to my expectation I cant get it to run. Here is my
problem.
I have a questionaire that has yes/no answers. On two occasions if the
answere is yes, this brings up a set of sub-questions relating to that
question. The questions are stored in a table as is the answers stored in a
table with the questionID as the PK.
I have included my code so far (which doesn't work :<( ) . Can anyone take a
look at it and give me some guidance on where I'm going wrong? Question 708
and 785 are the two questions that have sub-questions if answered yes. If I
need to provide more information please let me know that as well.
(I tried to write code in two different ways but no good.)
Thanks in advance for you assistance.
VR,
Red
Private Sub Command22_Click()
'next Question Button
Dim rst As DAO.Recordset
Set rst = Me.RecordsetClone
rst.Bookmark = Me.Bookmark
On Error GoTo Err_Command22_Click
'question has sub questions if answered "yes"
If Me.QuestionID = 708 And True Then
DoCmd.GoToRecord , , acNext
Else
Recordset.moveto QuestionID = 785, , acNext
End If
If Me.QuestionID = 785 And True Then
DoCmd.GoToRecord , , acNext
Else
GoToQuestionID = 710, , acNext
End If
' question has sub questions if answered "yes"
'If Me.QuestionID = 785 And Yes Then
'DoCmd.GoToRecord 786 - 789
' Else
' DoCmd.GoToRecord , , acNext
Err_Command22_Click:
MsgBox "You've Reached The End Of The Review"
'End If
End Sub