Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Have you tried keeping the connection open? This may only apply to linked tables in another accdb, not sure.</p> <p>I had this issue a while back so I now keep the connection open as long as Access is running, here's a stripped-down version of my sub for this:</p> <pre><code>Public Sub updateTables(bClose As Boolean) Dim dbsCurrent As Database Dim tdfSingle As TableDef Dim tdfCollection As TableDefs Dim sBasePath As String, sPath As String Set dbsCurrent = CurrentDb Set tdfCollection = dbsCurrent.TableDefs Set dbsHold = dbsCurrent Static dbsOpen As DAO.Database If bClose Then dbsOpen.Close Else sBasePath = Left(CurrentDb.Name, InStrRev(CurrentDb.Name, "\")) &amp; "SB-Support\" sPath = GetUNC(sBasePath &amp; "data.dat") Set dbsOpen = OpenDatabase(sPath, False, False, "MS Access;") For Each tdfSingle In tdfCollection If tdfSingle.SourceTableName &lt;&gt; "" Then If tdfSingle.Fields.Count = 0 Then tdfSingle.Connect = ";DATABASE=" &amp; sPath tdfSingle.RefreshLink End If End If Next End If Exit Sub </code></pre> <p>End Sub</p> <p>I think I originally retrieved it from here: <a href="http://www.fmsinc.com/microsoftaccess/performance/linkeddatabase.html" rel="nofollow">http://www.fmsinc.com/microsoftaccess/performance/linkeddatabase.html</a></p> <p>I don't have a SQL server requirement but a quick google gave me this for OpenDatabase for a SQL connection:</p> <pre><code>Dim cs As String Dim cn As DAO.Database Dim ws As DAO.Workspace Set ws = DBEngine.Workspaces(0) cs = "ODBC;DRIVER=SQL Server;SERVER=Main\SQLEXPRESS;DATABASE=Workwise;APP=Visual Basic" 'UID=Peter;PWD=" Set cn = ws.OpenDatabase("Workwise", dbDriverNoPrompt, True, cs) </code></pre> <p><a href="http://www.vbforums.com/archive/index.php/t-572723.html" rel="nofollow">http://www.vbforums.com/archive/index.php/t-572723.html</a></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload