I have a combobox named 'ContactPosition' that I am requiring contain a value by having a warning message appear before the form updates if 'ContactPosition' is Null or is a zero string. I use the SetFocus method and it works successfully, but after my MsgBox appears, the error 2105 appears stating "you can't go to the specified record." After a lot of searching I do not know why this error is still occuring and do not know how to intercept a specific error. Thank you for your help and have a great weekend!
Code:
Option Compare Database
Private Sub ContactType_AfterUpdate()
ContactPosition.Requery
ContactPosition.Value = ""
Me.ContactType.SetFocus
End Sub
Private Sub Region_AfterUpdate()
Borough.Requery
Borough.Value = ""
Neighborhood.Value = ""
End Sub
Private Sub Borough_AfterUpdate()
Neighborhood.Requery
Neighborhood.Value = ""
End Sub
Private Sub Form_BeforeUpdate(Cancel As Integer)
'Contact Position
If IsNull(Me.ContactPosition.Value) Or Me.ContactPosition.Value = "" Then
MsgBox ("Please select a contact position.")
Me.ContactPosition.SetFocus
End If
End Sub