Clear text entered by user when form is submitted

lundi 2 mars 2015

Ok so, I built a form that all of my supervisors use to calibrate agent calls- we all need to be on the same page as far as how things are scored for compliance.



After they score the line item, they can click a command button next to the line item to type their comments (a small, separate form pops-up where they enter the text). When they click "Save", the comments are automatically inserted into the "Comments" text box at the bottom of the form (don't even ask why I had to set it up this way). If they click the same command button again, then they can edit the notes for that line item.



The issue I am running into is that after a user submits their form (the data is stored in a table in the "parent" database), the next user to open it and enter their comments sees the text the previous user entered, which kinda defeats the purpose of calibrating. Any ideas on how to fix this?





Here is the VBA (just for the "Submit" button):



Private Sub cmdSubmit_Click()





Dim MsgBoxReturn As Integer

MsgBoxReturn = MsgBox("You will not be able to modify your form once submitted. Are you sure you are ready to submit your form and exit the Database?", vbYesNo)

If MsgBoxReturn = vbNo Then Exit Sub



Me.UserName = Environ("UserName")

Me.CalibrationDate = Now()



Dim ctl As Control

Dim vScore As Double

vScore = 0

For Each ctl In Me.Form

If ctl.ControlType = acComboBox Then

If IsNull(ctl.Value) = True Then

MsgBox "Form must be completely filled out in order to submit." & vbNewLine & "Please make a selection for " & ctl.Name

Exit Sub

Else

vScore = ctl.Value + vScore

End If

End If

Next ctl

Set ctl = Nothing



Me.Total_Score = vScore - Me.CalibrationNumber





Dim vPassFail As Double

vPassFail = 1

If Me.Q3 = 0 Then vPassFail = vPassFail * 0

If Me.Q4 = 0 Then vPassFail = vPassFail * 0

If Me.Q7 = 0 Then vPassFail = vPassFail * 0

If Me.Q8 = 0 Then vPassFail = vPassFail * 0

If Me.Q9 = 0 Then vPassFail = vPassFail * 0

If Me.Q10 = 0 Then vPassFail = vPassFail * 0

If Me.Q13 = 0 Then vPassFail = vPassFail * 0

If Me.Q14 = 0 Then vPassFail = vPassFail * 0

If Me.Q15 = 0 Then vPassFail = vPassFail * 0

If Me.Q16 = 0 Then vPassFail = vPassFail * 0





Dim vPassFailText



If vPassFail = 1 Then

Me.Pass_Fail = "Pass"

vPassFailText = "Passed"

Else

Me.Pass_Fail = "Fail"

vPassFailText = "Failed"

End If



Me.lblTotal_Score.Visible = True

Me.Total_Score.Visible = True

Me.Pass_Fail.Visible = True



MsgBox "Submission Successful!" & vbNewLine & "Score = " & Me.Total_Score & vbNewLine & "QM " & vPassFailText





DoCmd.Save

DoCmd.Quit



End Sub

Clear text entered by user when form is submitted

0 commentaires:

Enregistrer un commentaire

Labels