2108 and 2115 runtime error handling

jketcher

Registered User.
Local time
Today, 06:31
Joined
Apr 15, 2009
Messages
77
Hi,

I am working on some code that will check a combobox entry (category)against a table for duplicate entries. The code is working (with help from your colleagues) to display a msgbox that will redirect the user. But, no matter what I enter to redirect the focus and end the sub routine, I get either a 2108 or a 2115 error message. The code looks like this right now. What I want to do is display the message and refocus to a different tab control.

Private Sub category_beforeupdate(Cancel As Integer)
If DCount("*", "Operational Review Findings", "Client = '" & Me.Client & "' AND Category = '" & Me.Category & "'") > 0 Then
Category.BorderColor = vbRed
MsgBox "Duplicate Record - Select the Edit Findings tab to change input for this category."
Cancel = True
Me!Category = Null
Else
Category.BorderColor = vbBlack

End If

End Sub

How can I get this to work? You help is greatly appreciated :)

jketcher
 
You can't change the contents of your control in the before update event. Use the AfterUpdate event - should work fine.

Evan
 
That worked! Thank you so much. :)

jketcher
 

Users who are viewing this thread

Back
Top Bottom