Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>It is not impossible that the query is constructed to cause a table scan, and this is causing the problem.</p> <p>You seem to be working in VBA. It is possible to construct quite a few interesting queries as SQL strings in VBA and save them to new queries, update existing queries, use them for record sources for forms, or open recordsets. You can use DAO or ADO, depending on what you want to do. I have Oracle, so all I can do is suggest ideas using SQL Server, the connection in square brackets can be got by looking at the connection of a linked table (CurrentDb.TableDefs("NameOfTable").Connect):</p> <pre><code>Dim cn As New ADODB.Connection ''You can use Microsoft.ACE.OLEDB.12.0 or Microsoft.Jet.OLEDB.4.0 scn = "Provider=Microsoft.ACE.OLEDB.12.0;User ID=Admin;Data Source=" _ &amp; CurrentProject.FullName cn.Open scn ''An insert query, but you can see that is would be easy enough to ''select from two different databases s = "INSERT into [ODBC;Description=TEST;DRIVER=SQL Server;" _ &amp; "SERVER=ServerName\SQLEXPRESS;Trusted_Connection=Yes;" _ &amp; "DATABASE=test].Table2 (id, atext) select id, atext from table1" cn.Execute s </code></pre> <p>Or</p> <pre><code>''http://www.carlprothman.net/Default.aspx?tabid=87 strConnect = _ "Provider=sqloledb;" &amp; _ "Data Source=myServerName;" &amp; _ "Initial Catalog=Test;" &amp; _ "Integrated Security=SSPI" With cmd .ActiveConnection = strConnect .CommandType = adCmdText .CommandText = "SELECT ID, aText FROM table2 " _ &amp; "WHERE ID=?" .Parameters.Append .CreateParameter _ ("ID", adInteger, adParamInput, , 1) .CommandTimeout = 0 Set rs = .Execute End With </code></pre>
 

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