G
Guest
I built a little automated survey tool with normalized tables to hold
questions divided up by department etc. For each department being surveyed I
have a command button that activates the the following on it's OnClick Event:
Dim Answer As String
Dim MyQ As String
Dim CurDept As String
Dim Acct
Set Acct = New ADODB.Recordset
Acct.Open "Accounting", CurrentProject.Connection, adOpenStatic
Do Until Acct.EOF
Me.AcctQID = Acct![Q_ID]
MyQ = Acct![Question]
CurDept = Acct![Department_Name]
If Acct![CommentOnly] = False Then
Answer = InputBox("On a scale of 1 to 5, with 5 being the best," & vbCrLf &
vbCrLf & "Please rate your opinion of the following:" & vbCrLf & vbCrLf &
MyQ, "Rate The Level Of Service for" & " " & CurDept)
MyInput.Value = [Answer]
AcctQID.Value = [QID]
[Comment] = InputBox("Please add any comments you would like to make
concerning:" & " " & vbCrLf & vbCrLf & MyQ, "Add A Comment About" & " " &
CurDept)
Else
[Comment] = InputBox("Please add any comments you would like to make
concerning:" & " " & vbCrLf & vbCrLf & MyQ, "Add A Comment About" & " " &
CurDept)
End If
DoCmd.Save
Acct.MoveNext
DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70
DoCmd.GoToRecord , , acNewRec
Loop
I have two questions, but am open to any other suggestions as I am still
very new at all this.
1. What do I need to add so that if the cancel button is hit on the inputbox
it stops the routine altogether rather than just moves on to the next
record/question?
2. I don't understand what happens with error handling at all. What do I
need to add?
Thanks in advance, all comments/assistance appreciated.
questions divided up by department etc. For each department being surveyed I
have a command button that activates the the following on it's OnClick Event:
Dim Answer As String
Dim MyQ As String
Dim CurDept As String
Dim Acct
Set Acct = New ADODB.Recordset
Acct.Open "Accounting", CurrentProject.Connection, adOpenStatic
Do Until Acct.EOF
Me.AcctQID = Acct![Q_ID]
MyQ = Acct![Question]
CurDept = Acct![Department_Name]
If Acct![CommentOnly] = False Then
Answer = InputBox("On a scale of 1 to 5, with 5 being the best," & vbCrLf &
vbCrLf & "Please rate your opinion of the following:" & vbCrLf & vbCrLf &
MyQ, "Rate The Level Of Service for" & " " & CurDept)
MyInput.Value = [Answer]
AcctQID.Value = [QID]
[Comment] = InputBox("Please add any comments you would like to make
concerning:" & " " & vbCrLf & vbCrLf & MyQ, "Add A Comment About" & " " &
CurDept)
Else
[Comment] = InputBox("Please add any comments you would like to make
concerning:" & " " & vbCrLf & vbCrLf & MyQ, "Add A Comment About" & " " &
CurDept)
End If
DoCmd.Save
Acct.MoveNext
DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70
DoCmd.GoToRecord , , acNewRec
Loop
I have two questions, but am open to any other suggestions as I am still
very new at all this.
1. What do I need to add so that if the cancel button is hit on the inputbox
it stops the routine altogether rather than just moves on to the next
record/question?
2. I don't understand what happens with error handling at all. What do I
need to add?
Thanks in advance, all comments/assistance appreciated.