Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Macro interaction -> AUTOCAD2015 and Access2010

Status
Not open for further replies.

blackminimal

Industrial
Aug 6, 2015
1
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.RunMacro "CODIFICA DISEGNI"

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
 
Replies continue below

Recommended for you

Status
Not open for further replies.

Part and Inventory Search

Sponsor