Hi,
So here is the code i am using to check if the field called Q1 has been completed, if not then it takes the user back to the form and highlights the field in red. however the code still runs the rest of the code and the form gets closed. so i need to add in a break point if Q1 is not completed allow user to update and then user clicks on the button again?
Private Sub Command372_Click()
On Error GoTo HandleError
Dim strSql As String
Dim ctl As Variant
strSql = Text4
SetClipboard strSql
Text4.value = ""
If IsNull(Me.Q1) Then
Dialog.Box "Please complete all questions in section A!", vbCritical, "Data entry error..."
Me.Q1.BorderColor = vbRed
Me.Q1.SetFocus
DoCmd.GoToControl "Me.Q1"
Else
Me.Recordset.MoveNext
Dialog.Box "Template has been copied to Clipboard"
Call Run
HandleExit:
Exit Sub
HandleError:
Dialog.Box "You have completed all selected outcomes", vbInformation, "Task Complete"
DoCmd.SetWarnings False
DoCmd.OpenQuery "Update Record Set"
DoCmd.SetWarnings False
DoCmd.Close
End If
End Sub
So here is the code i am using to check if the field called Q1 has been completed, if not then it takes the user back to the form and highlights the field in red. however the code still runs the rest of the code and the form gets closed. so i need to add in a break point if Q1 is not completed allow user to update and then user clicks on the button again?
Private Sub Command372_Click()
On Error GoTo HandleError
Dim strSql As String
Dim ctl As Variant
strSql = Text4
SetClipboard strSql
Text4.value = ""
If IsNull(Me.Q1) Then
Dialog.Box "Please complete all questions in section A!", vbCritical, "Data entry error..."
Me.Q1.BorderColor = vbRed
Me.Q1.SetFocus
DoCmd.GoToControl "Me.Q1"
Else
Me.Recordset.MoveNext
Dialog.Box "Template has been copied to Clipboard"
Call Run
HandleExit:
Exit Sub
HandleError:
Dialog.Box "You have completed all selected outcomes", vbInformation, "Task Complete"
DoCmd.SetWarnings False
DoCmd.OpenQuery "Update Record Set"
DoCmd.SetWarnings False
DoCmd.Close
End If
End Sub
Last edited: