Hi RobDog,
I am having the exact same issue with my code. I get the "ActiveX component can't create object" error even with the On Error Resume Next code. How can I get around this? All I want to do is test for an instance of Access and if Access is open, close it. I am trying to avoid the exclusive lock error that occurs if the database I am ADO Connecting to is already open. Here is the beginning part of my code that contains the line of error (the line in which the error occurs is in red):
VB Code:
Private Sub UserForm_Initialize() ' Opens an ADO Connection to Issues Database and fills in arInfo fields with ' values from the database (ie Contacts, Categories, Status, etc). This is _ ' needed because the values from the DB are dynamic and can be changed by the user. ' This function should only be called 1 time when the "Add to AR Tracker" menu ' item is clicked, even if there are multiple selections in the ActiveExplorer. On Error Resume Next Dim CnnA As ADODB.Connection Dim statusRS As ADODB.Recordset Dim priorityRS As ADODB.Recordset Dim categoryRS As ADODB.Recordset Dim assignedToRS As ADODB.Recordset Dim aApp As Access.Application Set CnnA = New ADODB.Connection Set statusRS = New ADODB.Recordset Set priorityRS = New ADODB.Recordset Set categoryRS = New ADODB.Recordset Set assignedToRS = New ADODB.Recordset [COLOR=Red]Set aApp = GetObject(, "Access.Application")[/COLOR] If TypeName(aApp) <> "Nothing" Then 'An Access instance is running If MsgBox("Outlook must close your AR Tracker database in order to perform the requested action." _ & vbCr & "Do you want to Outlook to close your AR Tracker?", vbYesNo, "Close AR Tracker?") = vbYes Then aApp.Quit Else: GoTo End_Sub End If End If




Reply With Quote