LMORSE
LMORSE

Reputation: 41

Error message after Office update "Object or class does not support the set of events"

I believe that an Office update was installed on my work computer this week. Since then I am seeing an error message in a database I built.

PC = Windows 10 Enterprise OS Build 17763.557
Office = 365 ProPlus Version 1808 Build 10730.20348

I have a button on a form that runs a SQL search for a record and populates the form. This code has worked for over a year.

When clicking the button the code fails with the error message

"The expression On Click you entered as the event property setting produced the following error: Object or class does not support the set of events."

If I open Visual Basic alongside the form, the query runs without error.

I am not sure if the Office update and the error message are related. I do not believe any changes have been made to the code or database structure. No other error messages have been reported from other users.

Private Sub Command360_Click()
    If IsNull(Me.SEARCH_TEXT.Value) Or Me.SEARCH_TEXT.Value = "" Then
        MsgBox "Please type in your search keyword.", vbOKOnly, "Keyword Needed"
        Me.SEARCH_TEXT.BackColor = vbYellow
        Me.SEARCH_TEXT.SetFocus
    Else
        strsearch = Me.SEARCH_TEXT.Value
        Me.SEARCH_TEXT.BackColor = vbWhite
        SearchTask = "SELECT * FROM [tMASTER_BOREHOLE_LIST] WHERE ( ([HOLEID] Like ""*" & strsearch & "*"") OR ([TYPE] Like ""*" & strsearch & "*"") OR ([ALTERNATE_NAME1] Like ""*" & strsearch & "*"") OR ([ALTERNATE_NAME2] Like ""*" & strsearch & "*"") OR ([ALTERNATE_NAME3] Like ""*" & strsearch & "*"") OR ([Hole_Location] Like ""*" & strsearch & "*"") OR ([ALTERNATE_NAME4] Like ""*" & strsearch & "*"") OR ([Collar_Site_No] Like ""*" & strsearch & "*"") OR ([Site_ID] Like ""*" & strsearch & "*"") OR ([HOLE_NAME] Like ""*" & strsearch & "*"") OR ([Hole_Number] Like ""*" & strsearch & "*"") OR ([Design_Point_Number] Like ""*" & strsearch & "*"") OR ([STAKED_Point_Number] Like ""*" & strsearch & "*"") OR ([As_Drilled_Point_Number] Like ""*" & strsearch & "*"") OR ([COLLAR_LOCATION1] Like ""*" & strsearch & "*"") OR ([COLLAR_LOCATION] Like ""*" & strsearch & "*"") OR ([LW_FOR_SEALUP] Like ""*" & strsearch & "*""))"
        Me.RecordSource = SearchTask
    End If
End Sub

Upvotes: 1

Views: 5181

Answers (2)

ChufferMcDonald
ChufferMcDonald

Reputation: 13

I have also encountered this error before and it drove me insane. The issue seemed to be that we had two versions of Access installed on one computer.

Uninstalling all versions of office on our computers and then reinstalling them resolved this issue.

Upvotes: 0

half of a glazier
half of a glazier

Reputation: 2076

Apparently this error is common in databases that use foreign characters. From personal experience it picks events at random to error on, irrespective of the code inside the event.

Anyway, the solution that saved my database (and sanity) is decompiling, as explained on sourcedaddy, but I'll list the instructions here to save you having to follow yet another link.

  • Press Win + R to open the Run window, enter msaccess /decompile, and press Run
  • When Access opens, hold down shift and open your database
  • Once the database is open, exit Access fully
  • Restart Access and open your database again
  • Open the code editor, click Debug >> Compile
  • After the db compiles, close the code editor and click Compact and Repair Database in Database Tools

And magic!

Hope this saves someone else the hours I expended trying to fix this bug...

Upvotes: 3

Related Questions