rstQuestions is a recordset containing a set of questions. I am using the following code to move from one question to the next. I want my form to close automatically if I try to go to the next record after the last question. With the following code, I am not able to accomplish that. Instead I see one more empty record after the last question and then if I try to go further an error occurs related to the end of record.
If rstQuestions.EOF Then
DoCmd.Close acForm, "frmQuestions", acSaveNo
Else
DoCmd.GoToRecord , , acNext
End If
If rstQuestions.EOF Then
DoCmd.Close acForm, "frmQuestions", acSaveNo
Else
DoCmd.GoToRecord , , acNext
End If