Results 1 to 7 of 7

Locking Issue using ADO with Excel as a Database

Threaded View

scott.j.minard Locking Issue using ADO with... 08-15-2016, 06:50 PM
Norie Re: Locking Issue using ADO... 08-15-2016, 06:59 PM
scott.j.minard Re: Locking Issue using ADO... 08-15-2016, 07:01 PM
Kyle123 Re: Locking Issue using ADO... 08-16-2016, 01:06 AM
scott.j.minard Re: Locking Issue using ADO... 08-16-2016, 01:30 AM
Daniele85 Re: Locking Issue using ADO... 08-24-2016, 06:31 AM
Daniele85 Re: Locking Issue using ADO... 08-24-2016, 06:38 AM
  1. #1
    Registered User
    Join Date
    08-15-2016
    Location
    Sydney, Australia
    MS-Off Ver
    2010
    Posts
    3

    Locking Issue using ADO with Excel as a Database

    Hi,

    I currently have an ongoing issue using ADO with Excel as the BE database.
    My application uses an Excel (2010) workbook as a backend to store the required data, then uses another excel workbook to query (Using list objects with data connections) and also manipulate and edit the data in the back end using ADO recordsets. I have used this setup as MS Access is not currently an option, and I need multiple users to be able to manipulate and query data at the same time without read-only restrictions.

    The issue is that occasionally the excel BE database seems to go into a "Locked state". When in this "locked state", the recordset appears to update successfully. However, when I open the BE database or requery with a new ADO connection the changes have disappeared.
    The only way for me to fix this currently is to open the excel BE Database, hit Save and close the workbook.

    The most frustrating part is that most of the time it works without issue.

    Any help would be greatly appreciated. An example of my connection string is below...

     
    Function OpenADODBConnection(strSourceFile As String, HDR As String, IMEX As Integer, ByRef adodb As adodb.connection) As Boolean
    On Error GoTo debugger:
    '----Declare local variables ----------------------------------------------------------------------'
    Dim connString As String
    
    '--------------------------------------------------------------------------------------------------'
    Set adodb = CreateObject("ADODB.Connection")
    connString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source='" & strSourceFile & _
            "';Extended Properties='Excel 12.0;HDR=" & HDR & ";IMEX=" & IMEX & "';"
            adodb.Open connString
    If Not adodb Is Nothing Then
        OpenADODBConnection = True
    Else
        OpenADODBConnection = False
    End If
    myExit:
    Exit Function
    '----Error Handling --------------------------------------------------------------------------------'
    debugger:
        OpenADODBConnection = False
        
    End Function
    
    Sub test()
    
    Dim adodb As adodb.connection
    Dim rs As New Recordset
    OpenADODBConnection "C:\Users\minasa9\Documents\Matrix Testing\SHUTDOWN PLANNING DATABASE clear.xlsx", "YES", 1, adodb
    
    rs.Open "SELECT * FROM `ORDERS$`", adodb, adOpenKeyset, adLockOptimistic, -1
    
    if rs.recordCount > 0 then rs.movefirst
    
    rs.Fields(1).Value = "Test"
    rs.update
    
    set rs = nothing
    set adodb = nothing
    
    endsub
    Last edited by scott.j.minard; 08-15-2016 at 07:02 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Access Database and Excel Pivtot Table Issue
    By jefflab1 in forum Excel General
    Replies: 0
    Last Post: 08-11-2015, 11:05 PM
  2. Screen locking issue
    By incommlyndon in forum Excel General
    Replies: 0
    Last Post: 11-08-2013, 11:23 AM
  3. Autofilter issue using macro when locking worksheets
    By rajiraji in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-18-2013, 11:27 PM
  4. Help with macro, automatical locking cells when excel is closed but only locking 1 sh
    By snoopy1461 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-21-2011, 11:29 AM
  5. Excel accessing external database issue
    By wacattack in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-08-2010, 11:44 AM
  6. Issue trying to retrieve records from excel database
    By marktheman in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-14-2007, 04:24 PM
  7. Font issue? Excel locking up.
    By plunk25 in forum Excel General
    Replies: 1
    Last Post: 05-16-2006, 02:15 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1