<?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: Insert block Error &amp;quot;Key not found&amp;quot; in VBA Forum</title>
    <link>https://forums.autodesk.com/t5/vba-forum/insert-block-error-quot-key-not-found-quot/m-p/2307843#M18776</link>
    <description>Hi dbp428,&lt;BR /&gt;
&lt;BR /&gt;
In the VBAIDE select [Tools][References] and load the latest ADO library &lt;BR /&gt;
you find on your computer.&lt;BR /&gt;
&lt;BR /&gt;
If will be called "Microsoft ActiveX Data Objects 2.x Library"&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Regards&lt;BR /&gt;
&lt;BR /&gt;
Laurie&lt;BR /&gt;
&lt;BR /&gt;
dbp428 wrote:&lt;BR /&gt;
&amp;gt; I'm using 2000i I thought it did not connect to Jet or ADO? DAO?  how can I do it?</description>
    <pubDate>Fri, 25 Jul 2008 20:53:17 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2008-07-25T20:53:17Z</dc:date>
    <item>
      <title>Insert block Error "Key not found"</title>
      <link>https://forums.autodesk.com/t5/vba-forum/insert-block-error-quot-key-not-found-quot/m-p/2307835#M18768</link>
      <description>ACAD 2000i&lt;BR /&gt;
I am trying to insert a block using this code:&lt;BR /&gt;
&lt;BR /&gt;
    'OLE Automation Object Calls&lt;BR /&gt;
    Set AcadObj = GetObject(, "AutoCAD.Application")&lt;BR /&gt;
    Set ThisDrawing = AcadObj.ActiveDocument&lt;BR /&gt;
    Dim insertionPnt(0 To 2) As Double&lt;BR /&gt;
    Dim blockObj As AcadBlock&lt;BR /&gt;
    &lt;BR /&gt;
    ' specify insertion points&lt;BR /&gt;
    insertionPnt(0) = 0&lt;BR /&gt;
    insertionPnt(1) = 0&lt;BR /&gt;
    insertionPnt(2) = 0&lt;BR /&gt;
    &lt;BR /&gt;
    Dim docName, JobBlockName As String&lt;BR /&gt;
    docName = ThisDrawing.FullName&lt;BR /&gt;
    JobBlockName = "C:/Program Files/AutoCAD LT 2000/Sample PointTB.dwg"&lt;BR /&gt;
&lt;BR /&gt;
    Set blockRefObj = ThisDrawing.ModelSpace.InsertBlock(insertionPnt, JobBlockName, 1#, 1#, 1#, 0)&lt;BR /&gt;
     &lt;BR /&gt;
     ' Get the attributes for the block reference&lt;BR /&gt;
    Dim varAttributes As Variant&lt;BR /&gt;
    varAttributes = blockRefObj.GetAttributes&lt;BR /&gt;
    &lt;BR /&gt;
    ' Change the value of the attribute&lt;BR /&gt;
    ' Note: There is no SetAttributes. Once you have the variant array, you have the objects.&lt;BR /&gt;
    ' Changing them changes the objects in the drawing.&lt;BR /&gt;
    varAttributes(0).TextString = Me![ChainOfCustody Details subform].Form.SampleNum&lt;BR /&gt;
&lt;BR /&gt;
    Set AcadObj = Nothing&lt;BR /&gt;
---------------&lt;BR /&gt;
Error is on  Set blockRefObj = ThisDrawing.ModelSpace...&lt;BR /&gt;
&lt;BR /&gt;
Any Ideas&lt;BR /&gt;
TIA</description>
      <pubDate>Fri, 25 Jul 2008 14:51:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/insert-block-error-quot-key-not-found-quot/m-p/2307835#M18768</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2008-07-25T14:51:37Z</dc:date>
    </item>
    <item>
      <title>Re: Insert block Error "Key not found"</title>
      <link>https://forums.autodesk.com/t5/vba-forum/insert-block-error-quot-key-not-found-quot/m-p/2307836#M18769</link>
      <description>There error is caused by:&lt;BR /&gt;
&lt;BR /&gt;
JobBlockName = "C:/Program Files/AutoCAD LT 2000/Sample PointTB.dwg"&lt;BR /&gt;
&lt;BR /&gt;
Folder separator in file path shoud be backslash "\", not "/" (as if in &lt;BR /&gt;
LISP).&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
"dbp428" wrote in message news:5990649@discussion.autodesk.com...&lt;BR /&gt;
ACAD 2000i&lt;BR /&gt;
I am trying to insert a block using this code:&lt;BR /&gt;
&lt;BR /&gt;
    'OLE Automation Object Calls&lt;BR /&gt;
    Set AcadObj = GetObject(, "AutoCAD.Application")&lt;BR /&gt;
    Set ThisDrawing = AcadObj.ActiveDocument&lt;BR /&gt;
    Dim insertionPnt(0 To 2) As Double&lt;BR /&gt;
    Dim blockObj As AcadBlock&lt;BR /&gt;
&lt;BR /&gt;
    ' specify insertion points&lt;BR /&gt;
    insertionPnt(0) = 0&lt;BR /&gt;
    insertionPnt(1) = 0&lt;BR /&gt;
    insertionPnt(2) = 0&lt;BR /&gt;
&lt;BR /&gt;
    Dim docName, JobBlockName As String&lt;BR /&gt;
    docName = ThisDrawing.FullName&lt;BR /&gt;
    JobBlockName = "C:/Program Files/AutoCAD LT 2000/Sample PointTB.dwg"&lt;BR /&gt;
&lt;BR /&gt;
    Set blockRefObj = ThisDrawing.ModelSpace.InsertBlock(insertionPnt, &lt;BR /&gt;
JobBlockName, 1#, 1#, 1#, 0)&lt;BR /&gt;
&lt;BR /&gt;
     ' Get the attributes for the block reference&lt;BR /&gt;
    Dim varAttributes As Variant&lt;BR /&gt;
    varAttributes = blockRefObj.GetAttributes&lt;BR /&gt;
&lt;BR /&gt;
    ' Change the value of the attribute&lt;BR /&gt;
    ' Note: There is no SetAttributes. Once you have the variant array, you &lt;BR /&gt;
have the objects.&lt;BR /&gt;
    ' Changing them changes the objects in the drawing.&lt;BR /&gt;
    varAttributes(0).TextString = Me![ChainOfCustody Details &lt;BR /&gt;
subform].Form.SampleNum&lt;BR /&gt;
&lt;BR /&gt;
    Set AcadObj = Nothing&lt;BR /&gt;
---------------&lt;BR /&gt;
Error is on  Set blockRefObj = ThisDrawing.ModelSpace...&lt;BR /&gt;
&lt;BR /&gt;
Any Ideas&lt;BR /&gt;
TIA</description>
      <pubDate>Fri, 25 Jul 2008 16:34:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/insert-block-error-quot-key-not-found-quot/m-p/2307836#M18769</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2008-07-25T16:34:35Z</dc:date>
    </item>
    <item>
      <title>Re: Insert block Error "Key not found"</title>
      <link>https://forums.autodesk.com/t5/vba-forum/insert-block-error-quot-key-not-found-quot/m-p/2307837#M18770</link>
      <description>Oh Yes, I grabbed that path from a menu button I made.&lt;BR /&gt;
Thank you it works great!!!!</description>
      <pubDate>Fri, 25 Jul 2008 18:01:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/insert-block-error-quot-key-not-found-quot/m-p/2307837#M18770</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2008-07-25T18:01:46Z</dc:date>
    </item>
    <item>
      <title>Re: Insert block Error "Key not found"</title>
      <link>https://forums.autodesk.com/t5/vba-forum/insert-block-error-quot-key-not-found-quot/m-p/2307838#M18771</link>
      <description>Now how can I pause it so I can pick an insertion point for the block?</description>
      <pubDate>Fri, 25 Jul 2008 18:04:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/insert-block-error-quot-key-not-found-quot/m-p/2307838#M18771</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2008-07-25T18:04:16Z</dc:date>
    </item>
    <item>
      <title>Re: Insert block Error "Key not found"</title>
      <link>https://forums.autodesk.com/t5/vba-forum/insert-block-error-quot-key-not-found-quot/m-p/2307839#M18772</link>
      <description>You use AcadUtility.GetPoint() to get user input for point:&lt;BR /&gt;
&lt;BR /&gt;
Dim pt As Variant&lt;BR /&gt;
pt=ThisDrawing.Utility.GetPoint(, vbCr &amp;amp; "Pick insertion point: ")&lt;BR /&gt;
&lt;BR /&gt;
Of course you need to handle user input error, for example what if user &lt;BR /&gt;
press Esc to cancel the pick.&lt;BR /&gt;
&lt;BR /&gt;
However, your code seems implying that your project is run outside Acad as a &lt;BR /&gt;
stand-alone app (hence the GetObject() thing). If that is the case, you need &lt;BR /&gt;
to make sure your code transfer user from current Active Window of your app &lt;BR /&gt;
to Acad window. Otherwise, user may not see the "Pick insertion point: " &lt;BR /&gt;
prompt at Acad command line and the process would halt and appear frozen. &lt;BR /&gt;
After user's pick, you have to bring back the focus to your application.&lt;BR /&gt;
&lt;BR /&gt;
IMO, if you automate Acad from external application, it is VERY BAD design &lt;BR /&gt;
that the user needs to switch back and forth between your application and &lt;BR /&gt;
Acad. If the user need to interract with Acad, then the whole thng should be &lt;BR /&gt;
done within AutoCAD, which provided rich APIs to let you do that (LISP, VBA, &lt;BR /&gt;
ObjectARX, .NET API).&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
"dbp428" wrote in message news:5990913@discussion.autodesk.com...&lt;BR /&gt;
Now how can I pause it so I can pick an insertion point for the block?</description>
      <pubDate>Fri, 25 Jul 2008 18:36:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/insert-block-error-quot-key-not-found-quot/m-p/2307839#M18772</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2008-07-25T18:36:46Z</dc:date>
    </item>
    <item>
      <title>Re: Insert block Error "Key not found"</title>
      <link>https://forums.autodesk.com/t5/vba-forum/insert-block-error-quot-key-not-found-quot/m-p/2307840#M18773</link>
      <description>Yes that is whats happening, appears frozen.&lt;BR /&gt;
This is creating bubble pointers for Samples, I have a lot of samples in an Access database that all need to be located on the drawing. when I click the "Go" button in Access it will stay in AutoCAD until all of the data is picked and placed. I'm making a loop to read all records then insert a block for each one where the user (me) picks.</description>
      <pubDate>Fri, 25 Jul 2008 19:37:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/insert-block-error-quot-key-not-found-quot/m-p/2307840#M18773</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2008-07-25T19:37:40Z</dc:date>
    </item>
    <item>
      <title>Re: Insert block Error "Key not found"</title>
      <link>https://forums.autodesk.com/t5/vba-forum/insert-block-error-quot-key-not-found-quot/m-p/2307841#M18774</link>
      <description>You can easily write VBA in Acad to read data from MS Access database and to &lt;BR /&gt;
the block insertion accordingly inside Acad. In this case, your user does &lt;BR /&gt;
not need MS Access installed, and you can avoid to automate Acad from &lt;BR /&gt;
external application (MS Access application, in your case). Not to mention &lt;BR /&gt;
the speed gain if you have many data record to loop through. Again, with &lt;BR /&gt;
your situation, doing it by automating Acad from external app is by no means &lt;BR /&gt;
a good choice and results in poor user experience.&lt;BR /&gt;
&lt;BR /&gt;
"dbp428" wrote in message news:5991009@discussion.autodesk.com...&lt;BR /&gt;
Yes that is whats happening, appears frozen.&lt;BR /&gt;
This is creating bubble pointers for Samples, I have a lot of samples in an &lt;BR /&gt;
Access database that all need to be located on the drawing. when I click the &lt;BR /&gt;
"Go" button in Access it will stay in AutoCAD until all of the data is &lt;BR /&gt;
picked and placed. I'm making a loop to read all records then insert a block &lt;BR /&gt;
for each one where the user (me) picks.</description>
      <pubDate>Fri, 25 Jul 2008 20:02:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/insert-block-error-quot-key-not-found-quot/m-p/2307841#M18774</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2008-07-25T20:02:42Z</dc:date>
    </item>
    <item>
      <title>Re: Insert block Error "Key not found"</title>
      <link>https://forums.autodesk.com/t5/vba-forum/insert-block-error-quot-key-not-found-quot/m-p/2307842#M18775</link>
      <description>I'm using 2000i I thought it did not connect to Jet or ADO? DAO?  how can I do it?</description>
      <pubDate>Fri, 25 Jul 2008 20:38:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/insert-block-error-quot-key-not-found-quot/m-p/2307842#M18775</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2008-07-25T20:38:33Z</dc:date>
    </item>
    <item>
      <title>Re: Insert block Error "Key not found"</title>
      <link>https://forums.autodesk.com/t5/vba-forum/insert-block-error-quot-key-not-found-quot/m-p/2307843#M18776</link>
      <description>Hi dbp428,&lt;BR /&gt;
&lt;BR /&gt;
In the VBAIDE select [Tools][References] and load the latest ADO library &lt;BR /&gt;
you find on your computer.&lt;BR /&gt;
&lt;BR /&gt;
If will be called "Microsoft ActiveX Data Objects 2.x Library"&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Regards&lt;BR /&gt;
&lt;BR /&gt;
Laurie&lt;BR /&gt;
&lt;BR /&gt;
dbp428 wrote:&lt;BR /&gt;
&amp;gt; I'm using 2000i I thought it did not connect to Jet or ADO? DAO?  how can I do it?</description>
      <pubDate>Fri, 25 Jul 2008 20:53:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/insert-block-error-quot-key-not-found-quot/m-p/2307843#M18776</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2008-07-25T20:53:17Z</dc:date>
    </item>
    <item>
      <title>Re: Insert block Error "Key not found"</title>
      <link>https://forums.autodesk.com/t5/vba-forum/insert-block-error-quot-key-not-found-quot/m-p/2307844#M18777</link>
      <description>Thanks for that, Laurie,&lt;BR /&gt;
But the form objects are spase to none in AutoCAD, I have subforms and all kind of stuff in my Access app.  I think that's the best way to go since it's all already done.  I just need to finish Acad bubble thingy. here is my code so far.&lt;BR /&gt;
-----------&lt;BR /&gt;
    ' OLE Automation Object Calls for AutoCAD 2000i&lt;BR /&gt;
    Set AcadObj = GetObject(, "AutoCAD.Application")&lt;BR /&gt;
    Set ThisDrawing = AcadObj.ActiveDocument&lt;BR /&gt;
    &lt;BR /&gt;
    Dim blockObj As AcadBlock&lt;BR /&gt;
    Dim returnPntDonut, returnPntBlock As Variant&lt;BR /&gt;
    Dim docName, JobBlockName As String&lt;BR /&gt;
    Dim varAttributes As Variant&lt;BR /&gt;
    Dim Donut As AcadLWPolyline&lt;BR /&gt;
    &lt;BR /&gt;
    ' Bubble Pointer&lt;BR /&gt;
    JobBlockName = "C:\Program Files\AutoCAD LT 2000\Sample PointTB.dwg"&lt;BR /&gt;
    &lt;BR /&gt;
    ' pick insertion point on screen for donut&lt;BR /&gt;
    returnPntDonut = ThisDrawing.Utility.GetPoint(, "Pick point for dot: ")&lt;BR /&gt;
&lt;BR /&gt;
    'place donut at point above&lt;BR /&gt;
    &lt;BR /&gt;
    Set Donut = ThisDrawing.ModelSpace.AddLightWeightPolyline(returnPntDonut)&lt;BR /&gt;
    Donut.SetBulge 0, 1&lt;BR /&gt;
    Donut.SetBulge 1, 1&lt;BR /&gt;
&lt;BR /&gt;
    ' pick insertion point on screen for Sample point Bubble pointer&lt;BR /&gt;
    returnPntBlock = ThisDrawing.Utility.GetPoint(, "Pick point for Sample Point: ")&lt;BR /&gt;
    &lt;BR /&gt;
    ' insert Block&lt;BR /&gt;
    Set blockRefObj = ThisDrawing.ModelSpace.InsertBlock(returnPntBlock, JobBlockName, 1#, 1#, 1#, 0)&lt;BR /&gt;
     &lt;BR /&gt;
    ' Get the attributes for the block reference&lt;BR /&gt;
    varAttributes = blockRefObj.GetAttributes&lt;BR /&gt;
    &lt;BR /&gt;
    ' Change the value of the attribute&lt;BR /&gt;
    ' Note: There is no SetAttributes. Once you have the variant array, you have the objects.&lt;BR /&gt;
    ' Changing them changes the objects in the drawing.&lt;BR /&gt;
    SampleNumber = Right(Me![ChainOfCustody Details subform].Form.SampleNum, 4)&lt;BR /&gt;
    varAttributes(0).TextString = SampleNumber&lt;BR /&gt;
    &lt;BR /&gt;
    ' pick points for line from donut to bubble pointer&lt;BR /&gt;
    Dim lineObj As AcadLine&lt;BR /&gt;
    Set lineObj = ThisDrawing.ModelSpace.AddLine(basePnt, returnPnt)&lt;BR /&gt;
 &lt;BR /&gt;
    Set blockRefObj = Nothing&lt;BR /&gt;
    Set ThisDrawing = Nothing&lt;BR /&gt;
    Set AcadObj = Nothing</description>
      <pubDate>Fri, 25 Jul 2008 21:06:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/insert-block-error-quot-key-not-found-quot/m-p/2307844#M18777</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2008-07-25T21:06:34Z</dc:date>
    </item>
    <item>
      <title>Re: Insert block Error "Key not found"</title>
      <link>https://forums.autodesk.com/t5/vba-forum/insert-block-error-quot-key-not-found-quot/m-p/2307845#M18778</link>
      <description>Hi dbp428,&lt;BR /&gt;
&lt;BR /&gt;
You are wrong about the form objects in AutoCAD.  As I don't program in &lt;BR /&gt;
Access - I don't even have it on my computer - I'm unable to say if &lt;BR /&gt;
Access has a wider range of controls, but I would not expect that it does.&lt;BR /&gt;
&lt;BR /&gt;
It may have more elegant methods for moving data between the forms and &lt;BR /&gt;
the database, but I can't comment on that without the software to test.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Regards&lt;BR /&gt;
&lt;BR /&gt;
Laurie&lt;BR /&gt;
&lt;BR /&gt;
dbp428 wrote:&lt;BR /&gt;
&amp;gt; Thanks for that, Laurie,&lt;BR /&gt;
&amp;gt; But the form objects are spase to none in AutoCAD, I have subforms and all kind of stuff in my Access app.  I think that's the best way to go since it's all already done.  I just need to finish Acad bubble thingy. here is my code so far.&lt;BR /&gt;
&amp;gt; -----------&lt;BR /&gt;
&amp;gt;     ' OLE Automation Object Calls for AutoCAD 2000i&lt;BR /&gt;
&amp;gt;     Set AcadObj = GetObject(, "AutoCAD.Application")&lt;BR /&gt;
&amp;gt;     Set ThisDrawing = AcadObj.ActiveDocument&lt;BR /&gt;
&amp;gt;     &lt;BR /&gt;
&amp;gt;     Dim blockObj As AcadBlock&lt;BR /&gt;
&amp;gt;     Dim returnPntDonut, returnPntBlock As Variant&lt;BR /&gt;
&amp;gt;     Dim docName, JobBlockName As String&lt;BR /&gt;
&amp;gt;     Dim varAttributes As Variant&lt;BR /&gt;
&amp;gt;     Dim Donut As AcadLWPolyline&lt;BR /&gt;
&amp;gt;     &lt;BR /&gt;
&amp;gt;     ' Bubble Pointer&lt;BR /&gt;
&amp;gt;     JobBlockName = "C:\Program Files\AutoCAD LT 2000\Sample PointTB.dwg"&lt;BR /&gt;
&amp;gt;     &lt;BR /&gt;
&amp;gt;     ' pick insertion point on screen for donut&lt;BR /&gt;
&amp;gt;     returnPntDonut = ThisDrawing.Utility.GetPoint(, "Pick point for dot: ")&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt;     'place donut at point above&lt;BR /&gt;
&amp;gt;     &lt;BR /&gt;
&amp;gt;     Set Donut = ThisDrawing.ModelSpace.AddLightWeightPolyline(returnPntDonut)&lt;BR /&gt;
&amp;gt;     Donut.SetBulge 0, 1&lt;BR /&gt;
&amp;gt;     Donut.SetBulge 1, 1&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt;     ' pick insertion point on screen for Sample point Bubble pointer&lt;BR /&gt;
&amp;gt;     returnPntBlock = ThisDrawing.Utility.GetPoint(, "Pick point for Sample Point: ")&lt;BR /&gt;
&amp;gt;     &lt;BR /&gt;
&amp;gt;     ' insert Block&lt;BR /&gt;
&amp;gt;     Set blockRefObj = ThisDrawing.ModelSpace.InsertBlock(returnPntBlock, JobBlockName, 1#, 1#, 1#, 0)&lt;BR /&gt;
&amp;gt;      &lt;BR /&gt;
&amp;gt;     ' Get the attributes for the block reference&lt;BR /&gt;
&amp;gt;     varAttributes = blockRefObj.GetAttributes&lt;BR /&gt;
&amp;gt;     &lt;BR /&gt;
&amp;gt;     ' Change the value of the attribute&lt;BR /&gt;
&amp;gt;     ' Note: There is no SetAttributes. Once you have the variant array, you have the objects.&lt;BR /&gt;
&amp;gt;     ' Changing them changes the objects in the drawing.&lt;BR /&gt;
&amp;gt;     SampleNumber = Right(Me![ChainOfCustody Details subform].Form.SampleNum, 4)&lt;BR /&gt;
&amp;gt;     varAttributes(0).TextString = SampleNumber&lt;BR /&gt;
&amp;gt;     &lt;BR /&gt;
&amp;gt;     ' pick points for line from donut to bubble pointer&lt;BR /&gt;
&amp;gt;     Dim lineObj As AcadLine&lt;BR /&gt;
&amp;gt;     Set lineObj = ThisDrawing.ModelSpace.AddLine(basePnt, returnPnt)&lt;BR /&gt;
&amp;gt;  &lt;BR /&gt;
&amp;gt;     Set blockRefObj = Nothing&lt;BR /&gt;
&amp;gt;     Set ThisDrawing = Nothing&lt;BR /&gt;
&amp;gt;     Set AcadObj = Nothing</description>
      <pubDate>Sat, 26 Jul 2008 01:22:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/insert-block-error-quot-key-not-found-quot/m-p/2307845#M18778</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2008-07-26T01:22:19Z</dc:date>
    </item>
    <item>
      <title>Re: Insert block Error "Key not found"</title>
      <link>https://forums.autodesk.com/t5/vba-forum/insert-block-error-quot-key-not-found-quot/m-p/2307846#M18779</link>
      <description>In case anyone is interested: I needed to get to an Access database in my AutoCAD form. here is the code to do that.&lt;BR /&gt;
You have to add a reference in Microsoft ActiveX Data Objects 2.0 Library, In the VBA IDE click tools menu References, and go way down the list to find ones that start with Microsoft, then look for Microsoft ActiveX Data Objects 2.0 Library. Check the box next to it and click OK.&lt;BR /&gt;
I created a command button and created this code. Then I added a text box for my project number.&lt;BR /&gt;
------&lt;BR /&gt;
    Dim cnn As New ADODB.Connection, rec As ADODB.Recordset&lt;BR /&gt;
    Dim SQLString As String&lt;BR /&gt;
    Set cnn = New ADODB.Connection&lt;BR /&gt;
    Set rec = New ADODB.Recordset&lt;BR /&gt;
   cnn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=F:\Task Order\Facility Description_be.mdb;Persist Security Info=False"&lt;BR /&gt;
    cnn.Open&lt;BR /&gt;
    SQLString = "Select * From [ChainOfCustody Details] Where " &amp;amp; _&lt;BR /&gt;
              "[Project Number] = '" &amp;amp; Me.txtProjectNumber &amp;amp; "'"&lt;BR /&gt;
    rec.Open (SQLString), cnn, adOpenStatic, adLockReadOnly&lt;BR /&gt;
    TotalRecs = rec.RecordCount&lt;BR /&gt;
    For a = 1 To TotalRecs&lt;BR /&gt;
        Debug.Print rec.Fields("SampleNum")&lt;BR /&gt;
        rec.MoveNext&lt;BR /&gt;
    Next&lt;BR /&gt;
      &lt;BR /&gt;
    Set rec = Nothing&lt;BR /&gt;
    Set cnn = Nothing&lt;BR /&gt;
----------&lt;BR /&gt;
Now I have Microsoft Access (actually Office Professional 2003) installed on my computer so the reference may be there because of that. But this code does work I just finished it.&lt;BR /&gt;
&lt;BR /&gt;
Notes: &lt;BR /&gt;
F:\Task Order\Facility Description_be.mdb  is the location of the Access database on our server. It could be anywhere.&lt;BR /&gt;
ChainOfCustody Details is the Table in Access database I want to open&lt;BR /&gt;
SampleNum is the field in ChainOfCustody Details.  I am interested in getting the sample number. At some point will go into a bubble pointer (Wblock)

Message was edited by: dbp428</description>
      <pubDate>Mon, 28 Jul 2008 20:12:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/insert-block-error-quot-key-not-found-quot/m-p/2307846#M18779</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2008-07-28T20:12:36Z</dc:date>
    </item>
  </channel>
</rss>

