mike60smart
Registered User.
- Local time
- Today, 15:54
- Joined
- Aug 6, 2017
- Messages
- 2,123
Hi Everyone
I have a Continuous Form where I need to validate just 1 Control named "AchievementLevel"
I have tried adding the following Code to the On Click Event for Closing the Form.
When I try to run the Code Access Locks up?
Is there a better way to achieve this?
Any help appreciated.
I have a Continuous Form where I need to validate just 1 Control named "AchievementLevel"
I have tried adding the following Code to the On Click Event for Closing the Form.
When I try to run the Code Access Locks up?
Is there a better way to achieve this?
Any help appreciated.
Code:
Private Sub cmdClose_Click()
10 On Error GoTo cmdClose_Click_Error
Dim rs As DAO.Recordset
20 Set rs = Me.RecordsetClone
30 rs.MoveFirst
40 Do While Not rs.EOF
50 If IsNull(rs!AchievementLevel.Value) Then
60 MsgBox ("AchievementLevel cannot be blank")
70 Me.Bookmark = rs.Bookmark
80 Me.AchievementLevel.SetFocus
90 Exit Sub
100 End If
110 Loop
120 Set rs = Nothing
140 DoCmd.Close
150 On Error GoTo 0
160 Exit Sub
cmdClose_Click_Error:
170 MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure cmdClose_Click, line " & Erl & "."
End Sub