I have an xls file that is executed by more than one user (a maximum of ten usually).It contains a form with a button and in the onclick event of that button the following code executes:
Set cnNew = New ADODB.Connection
Set rsHistory = New ADODB.Recordset
cnNew.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & _
sClientDB & ";"
rsHistory.ActiveConnection = cnNew
sSql = "SELECT " _
& "h.FundID, " _
& "h.ValuationDate, " _
& "h.ValueType, " _
& "h.Value " _
& "FROM " _
& "tblInvescoHistorical h INNER JOIN " _
& "(SELECT DISTINCT Top 38 h2.ValuationDate " _
& "FROM tblInvescoHistorical h2 where h2.ValuationDate <= #" & Format(Range("NAV_DATE").Value, "dd mmm yyyy") & "# " _
& "ORDER BY h2.ValuationDate DESC) AS h3 ON h.ValuationDate = h3.ValuationDate " _
& "WHERE " _
& "h.FundId = " & "'" & sIv1 & "'" & _
" ORDER BY " _
& "h.ValuationDate DESC;"
With rsHistory
.Open sSql, cnNew, adOpenStatic, adLockReadOnly, adCmdText
Do Until .EOF Or iCurrLine <= PFOLIO_PERF_MIN
It stops with the following error (sometimes)
Run Time error - 2147467259 (80004005)
Record is deleted
I didn't write the code but it is executing fine when there is only one person. The problem is that everone is accessing the same xls file (on a mapped drive) and it can't handle too many users (the database it is accessing is also on a mapped drive).
Can anyone suggest a solution to this?
Thank you for any replies
Bookmarks