Database VBA application?

Discussion in 'AutoCAD' started by media, Nov 3, 2004.

  1. media

    media Guest

    Hi every body,
    I seek good ideas for an application which I develop :
    - i have a window displaying a group of records from a ms access database

    - I want to link a record that I choose (or a group of of records )
    with an object (or several autocad objects)

    - I want to create a data base of project which filled of the
    recordings linked to the autocad objects.

    - my data base of project would be filled by recordings related to
    objects of VARIOUS DWG files.

    - if in autocad, I make a copy of a cad object linked, automatically
    there would be a new addition record in my date base of project and if I
    remove it, of course, it would be removed from the data base of the project

    - it should be also also possible that i can select an autocad object,
    just by selecting the associated record (linked) and vice versa.

    If you have any idea helping me (i don't want use dbconnect), I
    appreciate very well
    thank you
     
    media, Nov 3, 2004
    #1
  2. You will need a value in the drawing and a value in a database table field
    that are equal so you can relate the two items. Often, an entity handle is
    used for this purpose. It works well for a one-to-one correspondence
    between a single drawing part and a single table record. Or, you can assign
    some value of your choosing, like a library part ID, to an attribute or
    Extended Entity Data (XData) of a drawing part. This is more suitable for
    relating parts used in many drawings to supplemental information in a
    database. You might even be able to do something with a drawing dictionary
    and XRecords. You can use MS ActiveX Data Objects (ADO) to connect the
    AutoCAD VBA code to the database. When the drawing opens, you will create
    an ADO recordset containing records from your database table(s). To
    automatically add/delete in the recordset when you add/delete in the
    drawing, you will probably want to enable application level events. In the
    BeginCommand or EndCommand event, check for a command that adds or deletes
    drawing parts. If one occurs, modify the recordset accordingly. When you
    are done with the drawing, maybe in the BeginSave or EndSave event, write
    the recordset back to the physical database table(s). That's it in a
    nutshell. Be advised that this type of project is a significant
    undertaking. You can start by studying the ADO Object Model in the Access
    online help.
     
    John Goodfellow, Nov 3, 2004
    #2
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.