Passing in the database name and table name opens the database and makes it visible for a split second until line 35 is executed.
Any ideas on how to prevent this? Or how to accomplish the same result with out the quick flash?
(placeing line 35 at line 25 won't work either)
Code:
Function OldestDate(RemoteDatabase As String, RemoteTable As String)
10 On Error Resume Next
Dim objAccess As Access.Application
20 Set objAccess = New Access.Application
30 objAccess.OpenCurrentDatabase RemoteDatabase
35 objAccess.Visible = False
40 OldestDate = objAccess.DMin("[Publish_Date]", RemoteTable)
50 If Err.Number = 2110 Then
60 OldestDate = 0 ' If table is deleted report 0 records
70 Err.Clear
80 End If
90 objAccess.CloseCurrentDatabase
100 Set objAccess = Nothing
End Function