Hi all
I want to include an option on a survey form which will be a "Skip" button. Basically when the user selects this, I want the code to insert assigned values (responses) for questions that were on the form.
The survey contains 6 sections (each with a separate form). Within each "Section", there are 10 questions. A couple sections are optional, so if the user selects skip, that section closes, next one opens.
I know this is wrong below (although some parts work). The parts that work are the QuestionChoice value and long response values entered into the table. The part that doesn't work is the SurveyQuestionID part (it only updates for the current question, not for all questions in that section). The example below I have the SurveyQuestion value assigned as the current question on the form.
I don't know how to program it so that it auto inserts the assigned values for ALL questions in that section? I am thinking it needs the "SectionID" in there somewhere also, so the code can identify what questions are assigned to that section, and insert the assigned values for every question in that section?
appreciate any help, hopefully explained it well enough above!
Thanks
TB
Private Sub cmdSkip_Click()
Dim SurveyQuestionID
Dim QuestionChoiceID
Dim LongResponse
SurveyQuestionID = Me.SurveyQuestionID
QuestionChoiceID = 0
LongResponse = "No Additional Comments provided by assessor."
Dim strSQL As String
strSQL = "INSERT INTO tblTEMPSurveyLongResponse (SurveyQuestionID, QuestionChoiceID,LongResponse) "
strSQL = strSQL & "VALUES "
strSQL = strSQL & "(" & SurveyQuestionID & ", " & QuestionChoiceID & ", '" & Replace(LongResponse, "'", """") & "')"
DoCmd.SetWarnings False
DoCmd.RunSQL strSQL
DoCmd.SetWarnings True
Me.txtComments = ""
DoCmd.Close
End Sub
I want to include an option on a survey form which will be a "Skip" button. Basically when the user selects this, I want the code to insert assigned values (responses) for questions that were on the form.
The survey contains 6 sections (each with a separate form). Within each "Section", there are 10 questions. A couple sections are optional, so if the user selects skip, that section closes, next one opens.
I know this is wrong below (although some parts work). The parts that work are the QuestionChoice value and long response values entered into the table. The part that doesn't work is the SurveyQuestionID part (it only updates for the current question, not for all questions in that section). The example below I have the SurveyQuestion value assigned as the current question on the form.
I don't know how to program it so that it auto inserts the assigned values for ALL questions in that section? I am thinking it needs the "SectionID" in there somewhere also, so the code can identify what questions are assigned to that section, and insert the assigned values for every question in that section?
appreciate any help, hopefully explained it well enough above!
Thanks
TB
Private Sub cmdSkip_Click()
Dim SurveyQuestionID
Dim QuestionChoiceID
Dim LongResponse
SurveyQuestionID = Me.SurveyQuestionID
QuestionChoiceID = 0
LongResponse = "No Additional Comments provided by assessor."
Dim strSQL As String
strSQL = "INSERT INTO tblTEMPSurveyLongResponse (SurveyQuestionID, QuestionChoiceID,LongResponse) "
strSQL = strSQL & "VALUES "
strSQL = strSQL & "(" & SurveyQuestionID & ", " & QuestionChoiceID & ", '" & Replace(LongResponse, "'", """") & "')"
DoCmd.SetWarnings False
DoCmd.RunSQL strSQL
DoCmd.SetWarnings True
Me.txtComments = ""
DoCmd.Close
End Sub