Contact US

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Macro interaction -> AUTOCAD2015 and Access2010

Macro interaction -> AUTOCAD2015 and Access2010

Macro interaction -> AUTOCAD2015 and Access2010

Hi everyone. I have a problem with a macro that I am trying to build.

The macro purpose is connect AUTOCAD 2015 to an Access 2010 database.

I need to create a button in AutoCAD environment, which automatically archives technical drawings. Every single draw will has a unique sequential code created by an existing Access macro
and recoded into database "CODIFICA.accdb".

I would like to take advantage of an existing macro in Access (called: "CODIFICA DISEGNI"). That macro creates sequential Codes for the drawing and other secondary parameters.

I am still blocked on the initial code, What I was able to put together And this:

Sub codice_nuovo_disegno_prova ()

A Dim Target As

Set A = CreateObject ("Access.Application")

A.Visible = False

A.OpenCurrentDatabase ("C: \ Users \ xxxxxxx \ Desktop \ CODIFICA.accdb")


A.DoCmd.SelectObject acForm, "PROTOCOLLO DISEGNI", True

A.DoCmd.Runcommand (PulsanteCreaNuovoCodice)

End Sub

On this few line of row code I made a mistake or forgot to activate some library because the Access database open, the macro run, the form activate but it gives me error:

"Run-time in 2501: the RunCommand Action Has Been Locked".

In my intentions, my AUTOCAD macro will:

- open the Access databese "CODIFICA.accdb"
- runs the macro "CODIFICA DISEGNI"
- activate the form "PROTOCOLLO DISEGNI"
- simulate button clicking "PulsanteCreaNuovoCodice" - this button allow to create the new sequential code (You can choose also to create more than one code) and record it on the database
- save the AUTOCAD draw on as the new sequential code on a folder
note: "PROTOCOLLO DISEGNI" is a form of the macro "CODIFICA DISEGNI" and "PulsanteCreaNuovoCodice" is a button on the form "PROTOCOLLO DISEGNI"

Currently everything is done manually with the two software AUTOCAD and ACCESS.

ps. If I remove the line of code "A.DoCmd.Runcommand (PulsanteCreaNuovoCodice)" the macro runs without errors, of course stops the opening of the macro and the form

I thank in advance who will help me

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members! Already a Member? Login


Close Box

Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close