Results 1 to 7 of 7

Thread: AutoCAD Electrical API to create Access DB Table

  1. #1
    Member
    Join Date
    2017-09
    Posts
    3
    Login to Give a bone
    0

    Default AutoCAD Electrical API to create Access DB Table

    Hello all,
    I try to work on a code based on an asnwer using MS Access file. Table Created but with empty records. What I am miss?

    Code:
    (setq fnam "D.MDB" ) ; <- modify fnam as needed
    (setq support "c:\\program files\\autodesk\\autocad 2021\\acade\\support\\en-us\")
    (if (setq hdl (wd_mdb_GetHandle 4)) ; <- autocad documentation doesn't cover this secret option
      (progn
    	(if (wd_mdb_Create hdl fnam 1 support)
    	  (progn
    		(wd_mdb_CreateTable hdl "A"
                           (list
                              (list "A" "S" 20) ; type = char string, field width = 20
                              (list "B" "S" 40)
                              (list "C" "S" 40)
                              (list "D" "S" 40)
                              (list "E" "A" 0))  ; type = autonumber
                              1  ; overwrite
    		          support
                       )
    	  )
    	)
    	(wd_mdb_Close hdl)
      )
    )
    (if (setq hdl (wd_mdb_GetHandle 2))
      (progn
    	(if
    	  (wd_mdb_Open 
    		hdl 
    		fnam
    	  )
    	  (progn
    		(wd_mdb_AddRecs hdl "A"
                      (list
                        (list (list "A" "A1")(list "B" "B1")(list "C" "C1")(list "D" "D1"))
                        (list (list "A" "A2")(list "B" "B2")(list "C" "C2")(list "D" "D2"))
    		  )
    	      )
    	  )
    	)
    	(wd_mdb_Close hdl)
      )
    )
    (wd_mdb_closeall)
    Last edited by Opie; 2022-12-27 at 03:14 PM. Reason: [code] tags added

  2. #2
    Administrator Opie's Avatar
    Join Date
    2002-01
    Location
    jUSt Here (a lot)
    Posts
    9,104
    Login to Give a bone
    0

    Default Re: AutoCAD Electrical API to create Access DB Table

    Are you trying to create an Excel file or an Access table? The title of the thread and the text in your post are contradictory.
    If you have a technical question, please find the appropriate forum and ask it there.
    You will get a quicker response from your fellow AUGI members than if you sent it to me via a PM or email.
    jUSt

  3. #3
    Member
    Join Date
    2017-09
    Posts
    3
    Login to Give a bone
    0

    Default Re: AutoCAD Electrical API to create Access DB Table

    I am trying to create an Access table. Thanks for help.

  4. #4
    Administrator Opie's Avatar
    Join Date
    2002-01
    Location
    jUSt Here (a lot)
    Posts
    9,104
    Login to Give a bone
    0

    Default Re: AutoCAD Electrical API to create Access DB Table

    I've split your post from the original thread.

    I do not use Electrical and thus do not know its API. There is a file on AUGI for working with database files called ADOLISP. This may require you to redo your code to accomplish your task. I haven't used it in many years and therefore would not be much help.
    If you have a technical question, please find the appropriate forum and ask it there.
    You will get a quicker response from your fellow AUGI members than if you sent it to me via a PM or email.
    jUSt

  5. #5
    Administrator Ed Jobe's Avatar
    Join Date
    2000-11
    Location
    Turlock, CA
    Posts
    6,419
    Login to Give a bone
    0

    Default Re: AutoCAD Electrical API to create Access DB Table

    Do you need to do this in lisp? There is no api for lisp. Microsoft does provide a robust api in VBA. I could help you with that. Would you like me to move this to the VBA forum?
    C:> ED WORKING....


    LinkedIn

  6. #6
    Member
    Join Date
    2017-09
    Posts
    3
    Login to Give a bone
    0

    Default Re: AutoCAD Electrical API to create Access DB Table

    Thanks for help! I need to do this in lisp but VBA is perfect solution too for my task.

  7. #7
    Administrator Ed Jobe's Avatar
    Join Date
    2000-11
    Location
    Turlock, CA
    Posts
    6,419
    Login to Give a bone
    0

    Default Re: AutoCAD Electrical API to create Access DB Table

    I've done tons of db work, but never in lisp. Apparently, you are referencing some other library to do your work. You should provide such information to get help with it... or make the switch to another language. NET also has great db api's and built in tools, plus it can create lisp commands. That might be a way to continue with lisp. However, .NET has a steep learning curve.
    C:> ED WORKING....


    LinkedIn

Similar Threads

  1. Replies: 1
    Last Post: 2019-04-19, 01:00 AM
  2. How to Create Access table data to AutoCAD VBa Combo box data
    By avinash00002002 in forum VBA/COM Interop
    Replies: 2
    Last Post: 2006-06-20, 08:22 PM
  3. Linking AutoCAD Object Data Table to Access table
    By m.storey in forum AutoCAD Map 3D - General
    Replies: 0
    Last Post: 2006-05-02, 02:54 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •