<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: in VBA Forum</title>
    <link>https://forums.autodesk.com/t5/vba-forum/access-database-and-autocad-2000/m-p/320747#M93729</link>
    <description>Quan,&lt;BR /&gt;
&lt;BR /&gt;
First of all, it will be hard to test without your MDB file... but just&lt;BR /&gt;
looking at the SQL I have a couple of comments.&lt;BR /&gt;
&lt;BR /&gt;
I presume that the line that reads:&lt;BR /&gt;
&lt;BR /&gt;
"strSQL = strSQL &amp;amp; "(SELECT PartNumber FROM Parts WHERE PartNumber BETWEEN&lt;BR /&gt;
50 AND 100)"&lt;BR /&gt;
&lt;BR /&gt;
Is being executed as:&lt;BR /&gt;
&lt;BR /&gt;
strSQL = strSQL &amp;amp; "(SELECT PartNum FROM NewParts WHERE PartNum BETWEEN 50&lt;BR /&gt;
AND 100)"&lt;BR /&gt;
&lt;BR /&gt;
Also, do you have the PartNumber field indexed in both tables? This will&lt;BR /&gt;
improve performance dramatically.&lt;BR /&gt;
&lt;BR /&gt;
Your SQL seems sound to me, but I always avoid using "IN" queries whenever&lt;BR /&gt;
possible. They are almost always slower then direct comparisons.&lt;BR /&gt;
&lt;BR /&gt;
(How big is the MDB? Is the MDB on a network share or local? How many&lt;BR /&gt;
records are in the tables? Have you compacted the MDB lately? etc.)&lt;BR /&gt;
&lt;BR /&gt;
--&lt;BR /&gt;
&lt;BR /&gt;
Until later,&lt;BR /&gt;
&lt;BR /&gt;
Jeremy McMahan&lt;BR /&gt;
Premier Product Support&lt;BR /&gt;
WW Support &amp;amp; Services, Autodesk&lt;BR /&gt;
Discussion Q&amp;amp;A: http://www.autodesk.com/discussion&lt;BR /&gt;
&lt;BR /&gt;
"Quan Kieu" &lt;QKIEU&gt; wrote in message&lt;BR /&gt;
news:ef04111.3@WebX.SaUCah8kaAW...&lt;BR /&gt;
&amp;gt; Hi Jemery,&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; We have a similar query that does not work neither in 97 nor Access 2000.&lt;BR /&gt;
&amp;gt; Would you have time to try this:&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;      strSQL = "SELECT DISTINCT PartNumber, Description "&lt;BR /&gt;
&amp;gt;      strSQL = strSQL &amp;amp; "FROM Parts "&lt;BR /&gt;
&amp;gt;     strSQL = strSQL &amp;amp; "WHERE PartNumber IN "&lt;BR /&gt;
&amp;gt;     strSQL = strSQL &amp;amp; "(SELECT PartNumber FROM Parts WHERE PartNumber&lt;BR /&gt;
&amp;gt; BETWEEN 50 AND 100)"&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; I known the sub-query in this sample make no sense,&lt;BR /&gt;
&amp;gt; but if you have column PartNum in table NewParts it will.&lt;BR /&gt;
&amp;gt; We could not get the result even between 9 and 10 for 5 minutes.&lt;BR /&gt;
&amp;gt; (The Jet engine is a funny name.)&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; Thanks&lt;BR /&gt;
&amp;gt;&lt;/QKIEU&gt;</description>
    <pubDate>Tue, 02 May 2000 14:19:51 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2000-05-02T14:19:51Z</dc:date>
    <item>
      <title>Access database and AutoCAD 2000</title>
      <link>https://forums.autodesk.com/t5/vba-forum/access-database-and-autocad-2000/m-p/320742#M93724</link>
      <description />
      <pubDate>Mon, 01 May 2000 19:09:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/access-database-and-autocad-2000/m-p/320742#M93724</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2000-05-01T19:09:33Z</dc:date>
    </item>
    <item>
      <title>Re: Access database and AutoCAD 2000</title>
      <link>https://forums.autodesk.com/t5/vba-forum/access-database-and-autocad-2000/m-p/320743#M93725</link>
      <description>Whats the easiset way for Access '97 and AutoCAD 2000 to interact as far as Extracting information out of AutoCAD drawings and having it show up in Access.&lt;BR /&gt;
I know how to control ACAD in VB/VBA using attributes and so forth. But is there an easier way like ODBC or something.</description>
      <pubDate>Mon, 01 May 2000 21:03:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/access-database-and-autocad-2000/m-p/320743#M93725</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2000-05-01T21:03:30Z</dc:date>
    </item>
    <item>
      <title>Re:</title>
      <link>https://forums.autodesk.com/t5/vba-forum/access-database-and-autocad-2000/m-p/320744#M93726</link>
      <description>Douglas,&lt;BR /&gt;
&lt;BR /&gt;
You can use the Data Access Object (DAO) in Windows by simply referencing it&lt;BR /&gt;
into your VBA project. ([Tools/References] then select "Microsoft DAO 3.x&lt;BR /&gt;
Oject Library".)&lt;BR /&gt;
&lt;BR /&gt;
This will allow you to use either an ODBC or Jet Database Engine connection&lt;BR /&gt;
to insert/update/select data from the MDB file directly. You may have to&lt;BR /&gt;
learn a little about the DAO, but that probably would be time well spent if&lt;BR /&gt;
you plan to work with databases in the future--and a ton of information is&lt;BR /&gt;
available on it.&lt;BR /&gt;
&lt;BR /&gt;
Here is some code that uses the Jet Database Engine. I pulled it from an old&lt;BR /&gt;
example I wrote, and it probably will not work in it's current state.&lt;BR /&gt;
(paths, filenames etc.) but it shows how to open you MDB file using the DAO.&lt;BR /&gt;
&lt;BR /&gt;
&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;BR /&gt;
Option Explicit&lt;BR /&gt;
&lt;BR /&gt;
Public gws As Workspace&lt;BR /&gt;
Public gdb As Database&lt;BR /&gt;
Public gstrDBName As String&lt;BR /&gt;
&lt;BR /&gt;
Public Function OpenPartsDatabase(strDatabasePath As String) As Boolean&lt;BR /&gt;
    OpenPartsDatabase = False&lt;BR /&gt;
&lt;BR /&gt;
    Dim strPswd As String&lt;BR /&gt;
&lt;BR /&gt;
    On Error GoTo UnknownError&lt;BR /&gt;
&lt;BR /&gt;
    If IsFileFound(strDatabasePath) Then&lt;BR /&gt;
&lt;BR /&gt;
        ' Sets password&lt;BR /&gt;
        strPswd = ""&lt;BR /&gt;
&lt;BR /&gt;
        ' sets and opens the global workspace&lt;BR /&gt;
        Set gws = CreateWorkspace("PartsWorkspace", "Admin", "", dbUseJet)&lt;BR /&gt;
&lt;BR /&gt;
        ' sets and opens the global database&lt;BR /&gt;
        Set gdb = gws.OpenDatabase(strDatabasePath, False, False, ";pwd=" &amp;amp;&lt;BR /&gt;
strPswd)&lt;BR /&gt;
&lt;BR /&gt;
    Else&lt;BR /&gt;
&lt;BR /&gt;
        GoTo UnknownError&lt;BR /&gt;
&lt;BR /&gt;
    End If&lt;BR /&gt;
&lt;BR /&gt;
    OpenPartsDatabase = True&lt;BR /&gt;
&lt;BR /&gt;
UnknownError:&lt;BR /&gt;
&lt;BR /&gt;
End Function&lt;BR /&gt;
&lt;BR /&gt;
Public Function IsFileFound(strFullFileName As String) As Boolean&lt;BR /&gt;
    IsFileFound = False&lt;BR /&gt;
&lt;BR /&gt;
    On Error GoTo TheFileWasntFound&lt;BR /&gt;
&lt;BR /&gt;
    If strFullFileName = "" Then&lt;BR /&gt;
&lt;BR /&gt;
        Exit Function&lt;BR /&gt;
&lt;BR /&gt;
    End If&lt;BR /&gt;
&lt;BR /&gt;
    If Dir(strFullFileName, vbNormal) &amp;lt;&amp;gt; "" Then&lt;BR /&gt;
&lt;BR /&gt;
        IsFileFound = True&lt;BR /&gt;
&lt;BR /&gt;
        Exit Function&lt;BR /&gt;
&lt;BR /&gt;
    End If&lt;BR /&gt;
&lt;BR /&gt;
TheFileWasntFound:&lt;BR /&gt;
&lt;BR /&gt;
End Function&lt;BR /&gt;
&lt;BR /&gt;
Function drawMyCube()&lt;BR /&gt;
&lt;BR /&gt;
    ThisDrawing.Regen False&lt;BR /&gt;
&lt;BR /&gt;
    If OpenPartsDatabase("C:\DrawBox.mdb") Then&lt;BR /&gt;
&lt;BR /&gt;
        frmBox.GetPartsList&lt;BR /&gt;
&lt;BR /&gt;
        frmBox.Show&lt;BR /&gt;
&lt;BR /&gt;
    Else&lt;BR /&gt;
&lt;BR /&gt;
        MsgBox "The database coudn't be found.", vbOKOnly, "Error opening&lt;BR /&gt;
database"&lt;BR /&gt;
&lt;BR /&gt;
    End If&lt;BR /&gt;
&lt;BR /&gt;
End Function&lt;BR /&gt;
&lt;BR /&gt;
Sub Test()&lt;BR /&gt;
&lt;BR /&gt;
    drawMyCube&lt;BR /&gt;
&lt;BR /&gt;
End Sub&lt;BR /&gt;
&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&lt;BR /&gt;
&lt;BR /&gt;
This code retrieves data from the MDB file.&lt;BR /&gt;
&lt;BR /&gt;
&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;BR /&gt;
Function GetPartsList() As Boolean&lt;BR /&gt;
    GetPartsList = False&lt;BR /&gt;
&lt;BR /&gt;
    Dim ors As Recordset&lt;BR /&gt;
    Dim strSQL As String&lt;BR /&gt;
&lt;BR /&gt;
    On Error GoTo UnknownError&lt;BR /&gt;
&lt;BR /&gt;
    strSQL = "SELECT DISTINCT PartNumber, Description "&lt;BR /&gt;
    strSQL = strSQL &amp;amp; "FROM Parts "&lt;BR /&gt;
    strSQL = strSQL &amp;amp; "ORDER BY PartNumber "&lt;BR /&gt;
&lt;BR /&gt;
    Set ors = gdb.OpenRecordset(strSQL, dbOpenSnapshot)&lt;BR /&gt;
&lt;BR /&gt;
    If ors.RecordCount Then&lt;BR /&gt;
&lt;BR /&gt;
        While Not ors.EOF&lt;BR /&gt;
&lt;BR /&gt;
            lstParts.AddItem (ors!PartNumber)&lt;BR /&gt;
            lstParts.List(lstParts.ListCount - 1, 0) = ors!PartNumber&lt;BR /&gt;
            lstParts.List(lstParts.ListCount - 1, 1) = ors!Description&lt;BR /&gt;
&lt;BR /&gt;
            ors.MoveNext&lt;BR /&gt;
&lt;BR /&gt;
        Wend&lt;BR /&gt;
&lt;BR /&gt;
        GetPartsList = True&lt;BR /&gt;
&lt;BR /&gt;
        lstParts.ListIndex = 0&lt;BR /&gt;
&lt;BR /&gt;
    End If&lt;BR /&gt;
&lt;BR /&gt;
    ors.Close&lt;BR /&gt;
&lt;BR /&gt;
UnknownError:&lt;BR /&gt;
&lt;BR /&gt;
End Function&lt;BR /&gt;
&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&lt;BR /&gt;
&lt;BR /&gt;
This code updates (puts) data in the MDB file. (You would probably use an&lt;BR /&gt;
"INSERT" query here.)&lt;BR /&gt;
&lt;BR /&gt;
&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;BR /&gt;
Function UpdateData() As Boolean&lt;BR /&gt;
    UpdateData = False&lt;BR /&gt;
&lt;BR /&gt;
    Dim strSQL As String&lt;BR /&gt;
&lt;BR /&gt;
    On Error GoTo UnknownError&lt;BR /&gt;
&lt;BR /&gt;
    strSQL = "UPDATE Parts "&lt;BR /&gt;
    strSQL = strSQL &amp;amp; "SET Length = " &amp;amp; txtLength &amp;amp; ", "&lt;BR /&gt;
    strSQL = strSQL &amp;amp; "Width = " &amp;amp; txtWidth &amp;amp; ", "&lt;BR /&gt;
    strSQL = strSQL &amp;amp; "Height = " &amp;amp; txtHeight &amp;amp; " "&lt;BR /&gt;
    strSQL = strSQL &amp;amp; "WHERE PartNumber = """ &amp;amp;&lt;BR /&gt;
lstParts.List(lstParts.ListIndex, 0) &amp;amp; """"&lt;BR /&gt;
&lt;BR /&gt;
    gdb.Execute strSQL&lt;BR /&gt;
&lt;BR /&gt;
    UpdateData = True&lt;BR /&gt;
&lt;BR /&gt;
UnknownError:&lt;BR /&gt;
&lt;BR /&gt;
End Function&lt;BR /&gt;
&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&lt;BR /&gt;
&lt;BR /&gt;
Notice that I use ANSI SQL for all my read/write opperations into the MDB&lt;BR /&gt;
file. This will allow you to easily move this code to use a ODBC record&lt;BR /&gt;
source if you ever want to. (A good habit.)&lt;BR /&gt;
&lt;BR /&gt;
All you have to do is change this:&lt;BR /&gt;
        Set gws = CreateWorkspace("PartsWorkspace", "Admin", "", dbUseJet)&lt;BR /&gt;
&lt;BR /&gt;
To this:&lt;BR /&gt;
        Set gws = CreateWorkspace("PartsWorkspace", "Admin", "", dbUseODBC)&lt;BR /&gt;
&lt;BR /&gt;
Then you might have to change the connection string (as the following line&lt;BR /&gt;
would not be valid for a SQL Server or Oracle connection:&lt;BR /&gt;
        Set gdb = gws.OpenDatabase(strDatabasePath, False, False, ";pwd=" &amp;amp;&lt;BR /&gt;
strPswd)&lt;BR /&gt;
&lt;BR /&gt;
I hope this helps!&lt;BR /&gt;
&lt;BR /&gt;
Until later,&lt;BR /&gt;
&lt;BR /&gt;
Jeremy McMahan&lt;BR /&gt;
Premier Product Support&lt;BR /&gt;
WW Support &amp;amp; Services, Autodesk&lt;BR /&gt;
Discussion Q&amp;amp;A: http://www.autodesk.com/discussion&lt;BR /&gt;
&lt;BR /&gt;
"DouglasPoston" &lt;DPOSTON&gt; wrote in message&lt;BR /&gt;
news:ef04111.0@WebX.SaUCah8kaAW...&lt;BR /&gt;
&amp;gt; Whats the easiset way for Access '97 and AutoCAD 2000 to interact as far&lt;BR /&gt;
as Extracting information out of AutoCAD drawings and having it show up in&lt;BR /&gt;
Access.&lt;BR /&gt;
&amp;gt; I know how to control ACAD in VB/VBA using attributes and so forth. But is&lt;BR /&gt;
there an easier way like ODBC or something.&lt;/DPOSTON&gt;</description>
      <pubDate>Mon, 01 May 2000 21:39:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/access-database-and-autocad-2000/m-p/320744#M93726</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2000-05-01T21:39:10Z</dc:date>
    </item>
    <item>
      <title>Re:</title>
      <link>https://forums.autodesk.com/t5/vba-forum/access-database-and-autocad-2000/m-p/320745#M93727</link>
      <description>ActiveX Data Objects is probably the way to go in your &lt;BR /&gt;
situation.  See "AutoCAD Database Connectivity", Scott &lt;BR /&gt;
McFarlane, ISBN 0-7668-1640-0.&lt;BR /&gt;
&lt;BR /&gt;
jrf&lt;BR /&gt;
Member of the Autodesk Discussion Forum Moderator Program&lt;BR /&gt;
&lt;BR /&gt;
In article &lt;EF04111.0&gt;, DouglasPoston wrote:&lt;BR /&gt;
&amp;gt; Whats the easiset way for Access '97 and AutoCAD 2000 to &lt;BR /&gt;
interact as far as Extracting information out of AutoCAD &lt;BR /&gt;
drawings and having it show up in Access.&lt;BR /&gt;
&amp;gt; I know how to control ACAD in VB/VBA using attributes and so &lt;BR /&gt;
forth. But is there an easier way like ODBC or something.&lt;BR /&gt;
&amp;gt;&lt;/EF04111.0&gt;</description>
      <pubDate>Mon, 01 May 2000 21:40:23 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/access-database-and-autocad-2000/m-p/320745#M93727</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2000-05-01T21:40:23Z</dc:date>
    </item>
    <item>
      <title>Re:</title>
      <link>https://forums.autodesk.com/t5/vba-forum/access-database-and-autocad-2000/m-p/320746#M93728</link>
      <description>Hi Jemery,&lt;BR /&gt;
&lt;BR /&gt;
We have a similar query that does not work neither in 97 nor Access 2000.&lt;BR /&gt;
Would you have time to try this:&lt;BR /&gt;
&lt;BR /&gt;
     strSQL = "SELECT DISTINCT PartNumber, Description "&lt;BR /&gt;
     strSQL = strSQL &amp;amp; "FROM Parts "&lt;BR /&gt;
    strSQL = strSQL &amp;amp; "WHERE PartNumber IN "&lt;BR /&gt;
    strSQL = strSQL &amp;amp; "(SELECT PartNumber FROM Parts WHERE PartNumber&lt;BR /&gt;
BETWEEN 50 AND 100)"&lt;BR /&gt;
&lt;BR /&gt;
I known the sub-query in this sample make no sense,&lt;BR /&gt;
but if you have column PartNum in table NewParts it will.&lt;BR /&gt;
We could not get the result even between 9 and 10 for 5 minutes.&lt;BR /&gt;
(The Jet engine is a funny name.)&lt;BR /&gt;
&lt;BR /&gt;
Thanks</description>
      <pubDate>Tue, 02 May 2000 13:51:44 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/access-database-and-autocad-2000/m-p/320746#M93728</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2000-05-02T13:51:44Z</dc:date>
    </item>
    <item>
      <title>Re:</title>
      <link>https://forums.autodesk.com/t5/vba-forum/access-database-and-autocad-2000/m-p/320747#M93729</link>
      <description>Quan,&lt;BR /&gt;
&lt;BR /&gt;
First of all, it will be hard to test without your MDB file... but just&lt;BR /&gt;
looking at the SQL I have a couple of comments.&lt;BR /&gt;
&lt;BR /&gt;
I presume that the line that reads:&lt;BR /&gt;
&lt;BR /&gt;
"strSQL = strSQL &amp;amp; "(SELECT PartNumber FROM Parts WHERE PartNumber BETWEEN&lt;BR /&gt;
50 AND 100)"&lt;BR /&gt;
&lt;BR /&gt;
Is being executed as:&lt;BR /&gt;
&lt;BR /&gt;
strSQL = strSQL &amp;amp; "(SELECT PartNum FROM NewParts WHERE PartNum BETWEEN 50&lt;BR /&gt;
AND 100)"&lt;BR /&gt;
&lt;BR /&gt;
Also, do you have the PartNumber field indexed in both tables? This will&lt;BR /&gt;
improve performance dramatically.&lt;BR /&gt;
&lt;BR /&gt;
Your SQL seems sound to me, but I always avoid using "IN" queries whenever&lt;BR /&gt;
possible. They are almost always slower then direct comparisons.&lt;BR /&gt;
&lt;BR /&gt;
(How big is the MDB? Is the MDB on a network share or local? How many&lt;BR /&gt;
records are in the tables? Have you compacted the MDB lately? etc.)&lt;BR /&gt;
&lt;BR /&gt;
--&lt;BR /&gt;
&lt;BR /&gt;
Until later,&lt;BR /&gt;
&lt;BR /&gt;
Jeremy McMahan&lt;BR /&gt;
Premier Product Support&lt;BR /&gt;
WW Support &amp;amp; Services, Autodesk&lt;BR /&gt;
Discussion Q&amp;amp;A: http://www.autodesk.com/discussion&lt;BR /&gt;
&lt;BR /&gt;
"Quan Kieu" &lt;QKIEU&gt; wrote in message&lt;BR /&gt;
news:ef04111.3@WebX.SaUCah8kaAW...&lt;BR /&gt;
&amp;gt; Hi Jemery,&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; We have a similar query that does not work neither in 97 nor Access 2000.&lt;BR /&gt;
&amp;gt; Would you have time to try this:&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;      strSQL = "SELECT DISTINCT PartNumber, Description "&lt;BR /&gt;
&amp;gt;      strSQL = strSQL &amp;amp; "FROM Parts "&lt;BR /&gt;
&amp;gt;     strSQL = strSQL &amp;amp; "WHERE PartNumber IN "&lt;BR /&gt;
&amp;gt;     strSQL = strSQL &amp;amp; "(SELECT PartNumber FROM Parts WHERE PartNumber&lt;BR /&gt;
&amp;gt; BETWEEN 50 AND 100)"&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; I known the sub-query in this sample make no sense,&lt;BR /&gt;
&amp;gt; but if you have column PartNum in table NewParts it will.&lt;BR /&gt;
&amp;gt; We could not get the result even between 9 and 10 for 5 minutes.&lt;BR /&gt;
&amp;gt; (The Jet engine is a funny name.)&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; Thanks&lt;BR /&gt;
&amp;gt;&lt;/QKIEU&gt;</description>
      <pubDate>Tue, 02 May 2000 14:19:51 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/access-database-and-autocad-2000/m-p/320747#M93729</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2000-05-02T14:19:51Z</dc:date>
    </item>
    <item>
      <title>Re:</title>
      <link>https://forums.autodesk.com/t5/vba-forum/access-database-and-autocad-2000/m-p/320748#M93730</link>
      <description>You wrote:&lt;BR /&gt;
You can use the Data Access Object (DAO) in Windows by simply referencing it into your VBA project. ([Tools/References] then select "Microsoft DAO 3.x Oject Library".) &lt;BR /&gt;
There is no "References" under Tools In AutoCAD 2000. I know its in Access or Visual Basic.&lt;BR /&gt;
My question is what can be done on the AutoCAD side to link to a .MDB.&lt;BR /&gt;
Or do I have to use the this code&lt;BR /&gt;
------------------------&lt;BR /&gt;
    Dim objAcadApp As AcadApplication&lt;BR /&gt;
    Dim ThisDrawing As AcadDocument&lt;BR /&gt;
&lt;BR /&gt;
    Set objAcadApp = CreateObject("AutoCAD.Application.15")&lt;BR /&gt;
    objAcadApp.Visible = True&lt;BR /&gt;
    Set ThisDrawing = objAcadApp.ActiveDocument&lt;BR /&gt;
    WhichDir = Direct1(dwgName)&lt;BR /&gt;
    ThisDrawing.Application.Documents.Open WhichDir &amp;amp; dwgName&lt;BR /&gt;
    Set ThisDrawing = objAcadApp.ActiveDocument</description>
      <pubDate>Tue, 02 May 2000 15:49:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/access-database-and-autocad-2000/m-p/320748#M93730</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2000-05-02T15:49:47Z</dc:date>
    </item>
    <item>
      <title>Re:</title>
      <link>https://forums.autodesk.com/t5/vba-forum/access-database-and-autocad-2000/m-p/320749#M93731</link>
      <description>Yes Jeremy,&lt;BR /&gt;
&lt;BR /&gt;
I did not think you have PartNum/NewPart in your database.&lt;BR /&gt;
So the sample query is odd, but it should work all the same.&lt;BR /&gt;
If you have any similar Column/Table, just try.&lt;BR /&gt;
&lt;BR /&gt;
Our database is around 22 Meg and we have columns indexed.&lt;BR /&gt;
There are about 120000 rows.&lt;BR /&gt;
We also have it packed.&lt;BR /&gt;
&lt;BR /&gt;
I have found that similar query:&lt;BR /&gt;
    SELECT DISTINCT ... WHERE x IN (SELECT y ...)&lt;BR /&gt;
is a big fault with the Jet in Access 97 even on a small database.&lt;BR /&gt;
Now we have Access 2000 with the same failure.&lt;BR /&gt;
&lt;BR /&gt;
It never takes more than a few seconds if I use an ODBC driver&lt;BR /&gt;
on the same query/database.&lt;BR /&gt;
(Ex: ODBC = 4 secs / JET = 20 min+ and we could not wait)&lt;BR /&gt;
&lt;BR /&gt;
You could try the query directly in MS Access.&lt;BR /&gt;
The MSQRY32.EXE that comes with many MS products, takes only a couple&lt;BR /&gt;
seconds.&lt;BR /&gt;
(Aren't they all from MS ? I guess one team is busy doing the PaperClip&lt;BR /&gt;
animation.)&lt;BR /&gt;
&lt;BR /&gt;
Thanks for trying.</description>
      <pubDate>Tue, 02 May 2000 15:57:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/access-database-and-autocad-2000/m-p/320749#M93731</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2000-05-02T15:57:02Z</dc:date>
    </item>
    <item>
      <title>Re:</title>
      <link>https://forums.autodesk.com/t5/vba-forum/access-database-and-autocad-2000/m-p/320750#M93732</link>
      <description>Thanks I just bought it Now on Amazon.com&lt;BR /&gt;
It is $35.96 &lt;BR /&gt;
use the isbn and leave out the dashes&lt;BR /&gt;
ISBN 0766816400</description>
      <pubDate>Tue, 02 May 2000 17:18:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/access-database-and-autocad-2000/m-p/320750#M93732</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2000-05-02T17:18:19Z</dc:date>
    </item>
    <item>
      <title>Re:</title>
      <link>https://forums.autodesk.com/t5/vba-forum/access-database-and-autocad-2000/m-p/320751#M93733</link>
      <description>Sorry about that...&lt;BR /&gt;
&lt;BR /&gt;
The [Tools] menu in question is in the VBA editor (VBAIDE) in AutoCAD 2000,&lt;BR /&gt;
not under AutoCAD 2000 itself.&lt;BR /&gt;
&lt;BR /&gt;
As for interactively... You could use the DBCONNECT feature of AutoCAD 2000.&lt;BR /&gt;
(See the on-line help for further details.)&lt;BR /&gt;
&lt;BR /&gt;
--&lt;BR /&gt;
&lt;BR /&gt;
Until later,&lt;BR /&gt;
&lt;BR /&gt;
Jeremy McMahan&lt;BR /&gt;
Premier Product Support&lt;BR /&gt;
WW Support &amp;amp; Services, Autodesk&lt;BR /&gt;
Discussion Q&amp;amp;A: http://www.autodesk.com/discussion&lt;BR /&gt;
&lt;BR /&gt;
"DouglasPoston" &lt;DPOSTON&gt; wrote in message&lt;BR /&gt;
news:ef04111.5@WebX.SaUCah8kaAW...&lt;BR /&gt;
&amp;gt; You wrote:&lt;BR /&gt;
&amp;gt; You can use the Data Access Object (DAO) in Windows by simply referencing&lt;BR /&gt;
it into your VBA project. ([Tools/References] then select "Microsoft DAO 3.x&lt;BR /&gt;
Oject Library".)&lt;BR /&gt;
&amp;gt; There is no "References" under Tools In AutoCAD 2000. I know its in Access&lt;BR /&gt;
or Visual Basic.&lt;BR /&gt;
&amp;gt; My question is what can be done on the AutoCAD side to link to a .MDB.&lt;BR /&gt;
&amp;gt; Or do I have to use the this code&lt;BR /&gt;
&amp;gt; ------------------------&lt;BR /&gt;
&amp;gt;     Dim objAcadApp As AcadApplication&lt;BR /&gt;
&amp;gt;     Dim ThisDrawing As AcadDocument&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;     Set objAcadApp = CreateObject("AutoCAD.Application.15")&lt;BR /&gt;
&amp;gt;     objAcadApp.Visible = True&lt;BR /&gt;
&amp;gt;     Set ThisDrawing = objAcadApp.ActiveDocument&lt;BR /&gt;
&amp;gt;     WhichDir = Direct1(dwgName)&lt;BR /&gt;
&amp;gt;     ThisDrawing.Application.Documents.Open WhichDir &amp;amp; dwgName&lt;BR /&gt;
&amp;gt;     Set ThisDrawing = objAcadApp.ActiveDocument&lt;BR /&gt;
&amp;gt;&lt;/DPOSTON&gt;</description>
      <pubDate>Tue, 02 May 2000 21:59:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/access-database-and-autocad-2000/m-p/320751#M93733</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2000-05-02T21:59:06Z</dc:date>
    </item>
    <item>
      <title>Re:</title>
      <link>https://forums.autodesk.com/t5/vba-forum/access-database-and-autocad-2000/m-p/320752#M93734</link>
      <description>Quan,&lt;BR /&gt;
&lt;BR /&gt;
Yeah... It is usually best to test the performance in you specific&lt;BR /&gt;
environment with the different options.&lt;BR /&gt;
&lt;BR /&gt;
To be honest, I have not tested nested query performance using .MDBs and/or&lt;BR /&gt;
the Jet engine. Most of my experience has been with ODBC and SQL&lt;BR /&gt;
Server/Oracle. Even there a nested query can significantly degrade&lt;BR /&gt;
performance. (I think it's because the engine can't use indexes on the&lt;BR /&gt;
results of the nested query... but that's just a theory.)&lt;BR /&gt;
&lt;BR /&gt;
You may also want to look in your SQL manual for information about the&lt;BR /&gt;
"HAVING" operand. Proper usage of this can often improve query performance.&lt;BR /&gt;
&lt;BR /&gt;
:-)&lt;BR /&gt;
&lt;BR /&gt;
--&lt;BR /&gt;
&lt;BR /&gt;
Until later,&lt;BR /&gt;
&lt;BR /&gt;
Jeremy McMahan&lt;BR /&gt;
Premier Product Support&lt;BR /&gt;
WW Support &amp;amp; Services, Autodesk&lt;BR /&gt;
Discussion Q&amp;amp;A: http://www.autodesk.com/discussion&lt;BR /&gt;
&lt;BR /&gt;
"Quan Kieu" &lt;QKIEU&gt; wrote in message&lt;BR /&gt;
news:ef04111.6@WebX.SaUCah8kaAW...&lt;BR /&gt;
&amp;gt; Yes Jeremy,&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; I did not think you have PartNum/NewPart in your database.&lt;BR /&gt;
&amp;gt; So the sample query is odd, but it should work all the same.&lt;BR /&gt;
&amp;gt; If you have any similar Column/Table, just try.&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; Our database is around 22 Meg and we have columns indexed.&lt;BR /&gt;
&amp;gt; There are about 120000 rows.&lt;BR /&gt;
&amp;gt; We also have it packed.&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; I have found that similar query:&lt;BR /&gt;
&amp;gt;     SELECT DISTINCT ... WHERE x IN (SELECT y ...)&lt;BR /&gt;
&amp;gt; is a big fault with the Jet in Access 97 even on a small database.&lt;BR /&gt;
&amp;gt; Now we have Access 2000 with the same failure.&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; It never takes more than a few seconds if I use an ODBC driver&lt;BR /&gt;
&amp;gt; on the same query/database.&lt;BR /&gt;
&amp;gt; (Ex: ODBC = 4 secs / JET = 20 min+ and we could not wait)&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; You could try the query directly in MS Access.&lt;BR /&gt;
&amp;gt; The MSQRY32.EXE that comes with many MS products, takes only a couple&lt;BR /&gt;
&amp;gt; seconds.&lt;BR /&gt;
&amp;gt; (Aren't they all from MS ? I guess one team is busy doing the PaperClip&lt;BR /&gt;
&amp;gt; animation.)&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; Thanks for trying.&lt;BR /&gt;
&amp;gt;&lt;/QKIEU&gt;</description>
      <pubDate>Tue, 02 May 2000 22:05:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/access-database-and-autocad-2000/m-p/320752#M93734</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2000-05-02T22:05:17Z</dc:date>
    </item>
  </channel>
</rss>

