J
Jake F
I'm creating a survey and need all questions answered. I've figured out how
to have a goto acLast button go to the last record that has not been
answered, but in doing so, did not account for what to do if all records have
been answered and you still want to go to the last one if you were reviewing
some. I was thinking that the If docmd.findrecord = true would work, but I
need a variable or function I guess.
Private Sub cmdLast_Click()
On Error GoTo Err_cmdLast_Click
If QstnNbr = 33 Then
MsgBox "You are currently at the last question.", vbOKOnly, "Safety
Survey"
End If
If Rspns = "Unanswered" Then
MsgBox "All questions must be answered.", vbOKOnly, "Safety Survey"
End If
If DoCmd.FindRecord("Unanswered", , True, , True, acAll) = True Then
DoCmd.FindRecord "Unanswered", , True, , True, acAll
Else
DoCmd.GoToRecord , , acLast
End If
Exit_cmdLast_Click:
Exit Sub
Err_cmdLast_Click:
MsgBox Err.Description
Resume Exit_cmdLast_Click
End Sub
to have a goto acLast button go to the last record that has not been
answered, but in doing so, did not account for what to do if all records have
been answered and you still want to go to the last one if you were reviewing
some. I was thinking that the If docmd.findrecord = true would work, but I
need a variable or function I guess.
Private Sub cmdLast_Click()
On Error GoTo Err_cmdLast_Click
If QstnNbr = 33 Then
MsgBox "You are currently at the last question.", vbOKOnly, "Safety
Survey"
End If
If Rspns = "Unanswered" Then
MsgBox "All questions must be answered.", vbOKOnly, "Safety Survey"
End If
If DoCmd.FindRecord("Unanswered", , True, , True, acAll) = True Then
DoCmd.FindRecord "Unanswered", , True, , True, acAll
Else
DoCmd.GoToRecord , , acLast
End If
Exit_cmdLast_Click:
Exit Sub
Err_cmdLast_Click:
MsgBox Err.Description
Resume Exit_cmdLast_Click
End Sub