This is the code thats ran immediately before opening the form in question.
When a user clicks FAIL in one of the 8 questions, the Question Number and Answer theyve provided is passed to the following Sub eg
Call Record_Answer("3","Fail")
Private Sub Record_Answer(TheQuestion, TheAnswer)
Dim SQLOut(15) As Variant
'Delete any existing answers
SQLOut(1) = "DELETE tblAnswers.CaseID, tblAnswers.Q_No FROM tblAnswers WHERE (((tblAnswers.[CaseID])=" & currCaseID & ") AND ((tblAnswers.[Q_No])= '" & TheQuestion & "'));"
'add any new ones
SQLOut(2) = "INSERT INTO tblAnswers ( CaseID, Q_No, Answer, Delay, Other ) SELECT " & currCaseID & ", '" & TheQuestion & "', '" & TheAnswer & "', " & TheDelay & ", '" & strOtherReason & "';"
SQLOut(3) = "DELETE CaseID FROM tblFails WHERE ((tblFails.CaseID = " & currCaseID & ") AND (tblFails.Question = " & TheQuestion & "));"
Call InsertArrayload(SQLOut, 4)
'if Its a Fail then set some indicators and open the Failures form
If (TheAnswer = "Fail") Then
strOtherReason = ""
TheDelay = 0
intFailCall = 1
strQstn = TheQuestion
frmFail.Show
Else
'otherwise everything is cool and we can just update the Answers indicator to show this as Pass or NA
Mid(AllQuestionsComplete, TheQuestion, 1) = Left(TheAnswer, 1)
End If
End Sub
basically, it
1. Deletes any records in the tblAnswers table (which contains a number of fields including the "Pass", "Fail","NA" status of the question)
2. Deletes any records in tblFails table for that case and question.
Inserts a new record in tblAnswers with the relevant answer, the answers for tblFails will then be INSERTed when the Save button is clicked on the form
If its a FAIL then it resets a couple of indicators that may be used later on and opens the frmFail form (the one I have a problem with)
I know what you're saying about Global Variables and would agree however I inherited this system at the point of going into user testing and although Im willing to do it, would involve a lot of rewriting to ensure its passing the variables here there and everywhere when required.
I'll give the new Instance a go but surely, if it was something like that (or the Global variables) then it would affect all users? Thats the bit thats got me most confused how its only 3 users and alwys the same questions in each users case.
Bookmarks