Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

Push/Pull Custom Props with MS Access

Status
Not open for further replies.

deek05

Mechanical
Jan 11, 2002
48
I am trying to Push/Pull Custom Props with MS Access...does anyone have any suggestions or sample code to get me started? I looked at the SW help file for AddCustomInfo3, I just don't understand how to link the 2 programs. I have been trying to put the code in Access and push the info into SW (file is open)...no luck! I have built quite a few database but have never linked to another program (like SW).

TIA,

DT
 
Replies continue below

Recommended for you

Not sure about Access, but I've written a macro in Excel that pulled info from solidworks. You have to 'link' to SW with the following placed at the beginning of your code:

[tt]Set swApp = CreateObject("SldWorks.Application")
Set Part = swApp.ActiveDoc[/tt]

Note: this was written in SW2001+ and unfortunately I haven't written anything in 2003 (i.e. there might be a better way).
 
It comes down to having two separate application object: one for SW and one for Access. Each has its own API (sets of objects, methods, properties, accessors). Think of the VB program as the communicator between the two applications.

Bring SW properties into VB variables using modeldoc2.customino(). Then set the Access database properties from the VB variable. The reverse for Access to SW.

Also important: AddCustomInfo does not overwrite existing properties. If necessary to overwrite, follow up with modeldoc.CustomInfo().

[bat]Good and evil: wrap them up and disguise it as people.[bat]
 
A little foreshadowing from The Tick.....

Stick arond a day or two and you will see a post regarding a macro that copies custom info that I will be posting for general distribution.

[bat]Good and evil: wrap them up and disguise it as people.[bat]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor