I am experiencing this error:
"The expression On Click you entered as the event property setting produced the following error: A problem occurred while Microsoft Access was communicating with the OLE server or ActiveX Control."
My database is not online (connected to a LAN shared drive but not the web), so I don't know what it means by communicating with the OLE server, and the suggestions for the problem say that my expression may not be the name of a macro, etc., or [Event Procedure], but when I look it says [Event Procedure] in the property sheet for that button, and all of the other events are blank. It suggests there may be an error evaluating the function/event/macro, but I don't know how to diagnose this because I am new to visual basic and relatively new to Access.
It's a button that, when clicked, runs some code that I based on someone else's code for changing some SQL and opening a form with a newly written query embedded.
If anyone has any ideas for what is causing this, or just general steps to troubleshoot, that would be appreciated. Below is the code, there is only one input field from a form (AppType), but I plan to expand this to include other filters once I have this working for one.
Code:
Private Sub apply_click()
Dim strSQL As String
Dim strApp As Variant
'unsure if needs to be string, variant, etc., or if that matters
Dim qdf As DAO.QueryDef
Let strApp = [AppType]
'unsure if this ^ is correct syntax
If strApp <> "" Then
strSQL = "SELECT * FROM qryAllData WHERE tblUsage.usage = " & strApp & ";" 'tblUsage contains relationships between input [AppType] and part numbers (primary key for qryAllData)
Else: strSQL = "SELECT * FROM qryAllData;"
End If
Set qdf = CurrentDb.QueryDefs("qryAdvisor")
qdf.SQL = strSQL
qdf.Close
DoCmd.OpenForm ("Advice") 'Contains qryAdvisor in the form
Set qdf = Nothing
End Sub
Note: I will not be able to reply to anything outside of M-W-F, 3PM-7PM CDT because this is a work project (odd hours because part-time intern)