Hi,
I have a subform with several required comboboxes. I have the following validation code:
When I click on cboType and choose "PSD", without entering a date,
the first part of the code works fine and it shows me -> MsgBox "If you want to continue please enter a 'Inspector'. "Otherwise press ESC.". "Аttention!".
But then when I click "OK", it shows me access error - Run-time error '2101': The setting you entered isn't valid for this property.
What can I do to prevent this access message from coming up!
Thanks
I have a subform with several required comboboxes. I have the following validation code:
Code:
Private Sub Form_BeforeUpdate(Cancel As Integer)
If Me.Parent.objectID = "" Or IsNull(Me.Parent.objectID) Then
MsgBox "Please select an object.", vbInformation, "Аttention!"
Me.Undo
End If
If Not Nz(Me.inspectionID, "") = "" And Nz(Me.Date, "") = "" Then
MsgBox "If you want to continue please enter a 'Date '." & vbCrLf & _
"Otherwise press ESC.", vbInformation, "Аttention!"
Cancel = True
Exit Sub
End If
If Not Nz(Me.Date, "") = "" And Nz(Me.inspector, "") = "" Then
MsgBox "If you want to continue please enter a 'Inspector '." & vbCrLf & _
"Otherwise press ESC.", vbInformation, "Аttention!"
Cancel = True
Exit Sub
End If
If Not Nz(Me.inspector, "") = "" And Nz(Me.Type, "") = "" Then
MsgBox "If you want to continue please enter a 'Type '." & vbCrLf & _
"Otherwise press ESC.", vbInformation, "Аttention!"
Cancel = True
Exit Sub
End If
End Sub
Code:
Private Sub cboType_AfterUpdate()
If Me.Dirty = True Then
Me.Dirty = False
End If
If Me.cboType = "PSD" Then
DoCmd.OpenForm "fm_inspection, , , "[inspectionID]=" & Me.inspectionID
DoCmd.GoToControl "PSD"
Exit Sub
End If
End Sub
the first part of the code works fine and it shows me -> MsgBox "If you want to continue please enter a 'Inspector'. "Otherwise press ESC.". "Аttention!".
But then when I click "OK", it shows me access error - Run-time error '2101': The setting you entered isn't valid for this property.
What can I do to prevent this access message from coming up!
Thanks