I have problem with application Excel via Access.
Few years ago I made application where Excel connecting with Access as database.
But last time, aftes some windows update I have problem.
When I use this string:
Public Const strconnectread = "Provider=Microsoft.ACE.OLEDB.16.0; Mode=Read; Data Source= S:\xxxxx\ARR_CUST2.accdb;"
I have error 8004005.
When I delete command Mode=Read
all works good except... .laccdb file which locked access database and operation like insert or delete for other users. In my application everywhere I close connect and recordsets but .laccdb pernament exist, and when I delete manually that file - it showing again and not closed after close of connect.
How I can fix it?
Below my code:
Option Explicit
Public Const strconnectread = "Provider=Microsoft.ACE.OLEDB.16.0; Mode=Read; Data Source= \\xxxx\ARR_CUST2.accdb;"
Private Sub UserForm_Initialize()
Dim Conn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim sqldown As String
Dim y As Integer, i As Integer
Set Conn = CreateObject("ADODB.Connection")
Set rs = CreateObject("ADODB.Recordset")
Conn.Open strconnectread
sqldown = "SELECT distinct [REFERENCE_DATE] FROM ARR_RATA"
rs.Open sqldown, Conn
Do While Not rs.EOF
Me.CB_REFER_DATE.AddItem Format(rs(0), "yyyy-mm-dd")
rs.MoveNext
Loop
rs.Close
Conn.Close
If Not Conn Is Nothing Then
If Conn.State = adStateOpen Then
Conn.Close
Set Conn = Nothing
End If
End If
Set rs = Nothing
Set Conn = Nothing
End Sub