Hi Guys,
I am using ACCESS 2010, win 7 Home Premium 64bit
I have a really a difficult to handle error when executing my report. I put a code into OnOpen section but ACCESS states:
Thanks for all help.
Below, the code in my report "module":
I am using ACCESS 2010, win 7 Home Premium 64bit
I have a really a difficult to handle error when executing my report. I put a code into OnOpen section but ACCESS states:
Additionally it says in description:The expression OnOpen you entered as the event property produced the following error: A problem occurred while Microsoft Access was communicating with the OLE server or ActiveX Control.
I am genuinely confused by that. I have also provided the code in the case if I am missing something I don't know yet. In a debug window, I have executed the code line by line and it worked. Whenever I try to open the report, the error occurs. Should I be aware of something when I write code for reports?This error occurs when an event has failed to run because the location of the logic for the event cannot be evaluated. For example, if the OnOpen property of a form is set to =[Field], this error occurs because a macro or event name is expected to run when the event occurs.
Thanks for all help.
Below, the code in my report "module":
Code:
Private Sub Report_Open(Cancel As Integer)
Call CreateTempTable
End Sub
Private Sub CreateTempTable()
On Error GoTo ErrorHandler
Dim strTable As String
Dim strScTable As String
Dim strSQL As String
Dim strSQLDelete As String
strTable = "tbl_tempRoznica"
strScTable = "qr_roznica"
DoCmd.DeleteObject acTable, strTable
' Updating table
strSQL = "SELECT " & strScTable & ".* INTO " & strTable & " FROM " & strScTable & ";"
CurrentDb.Execute strSQL
RefreshDatabaseWindow
Exit Sub
ErrorHandler:
If Err.Number = 7874 Then
Resume Next ' Try to delete non-existing table, so resume next
End If
End Sub