×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

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!
  • Students Click Here

*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

Jobs

Using MS Access as a front end for SW

Using MS Access as a front end for SW

Using MS Access as a front end for SW

(OP)
Is it possible to create/open a new solidworks file and populate some of it's properties using MSAccess as a front end? I'm pretty sure opening or creating the file is simple enough, but what about it's properties.
I have a MSAccess guru at my disposal he just needs some basic direction.
Thanks,
Tom

Tom Malinski
http://www.okayind.com/
Dell Prec 670, Xeon 3.8,2GB Ram, Nvidia Quadra FX 3450/4000 SDI
SWorks Pro & PDMWorks 2007 SP3.0

RE: Using MS Access as a front end for SW

Wouldn't the properties be in the template that the file uses?

Jeff Mirisola, CSWP
CAD Administrator
SW '07 SP2.0, Dell M90, Intel 2 Duo Core, 2GB RAM, nVidia 2500M
http://designsmarter.typepad.com/jeffs_blog

RE: Using MS Access as a front end for SW

(OP)
The properties are there from the template file, but the values put into them would need to be updated for each file.
Example:

DetailNo
ToolNo
Description

My Access database automatically bumps these values and generates the next sequential file name also!

Tom Malinski
http://www.okayind.com/
Dell Prec 670, Xeon 3.8,2GB Ram, Nvidia Quadra FX 3450/4000 SDI
SWorks Pro & PDMWorks 2007 SP3.0

RE: Using MS Access as a front end for SW

No problem.  You can open a file, add or edit properties and save as a new file.  Here is an example for your Access guru.  Remind him/her to enable the SolidWorks type libraries in the Access VBA references.  This example opens a part file, adds a description custom property and saves as a new file.  The custom properties do not need to be already created in the original SolidWorks file.

CODE

Private Sub cmdButton_Click()

Dim swApp               As SldWorks.SldWorks
Dim swDoc               As SldWorks.ModelDoc2
Dim lErrors             As Long
Dim lWarnings           As Long
Dim BoolStatus          As Boolean
Dim strTemplateName     As String
Dim strDocName          As String
    
Set swApp = CreateObject("SldWorks.Application")
strTemplateName = "C:\\MyPart.sldprt"
Set swDoc = swApp.OpenDoc6(strTemplateName,swDocPART, swOpenDocOptions_Silent, "", lErrors,  lWarnings)
BoolStatus = swDoc.AddCustomInfo3("", "Description", swCustomInfoText, "My Description")
    
strDocName = "C:\\MyNewPart.sldprt"
BoolStatus = swDoc.SaveAs4(strDocName, swSaveAsCurrentVersion, swSaveAsOptions_Copy, lErrors, lWarnings)
swApp.CloseDoc (strTemplateName)
   
Set swDoc = Nothing
Set swApp = Nothing

End Sub

RE: Using MS Access as a front end for SW

(OP)
Stoker, thanks for the help. I'm sure this will give us a kick start.

a star for you...

tom

Tom Malinski
http://www.okayind.com/
Dell Prec 670, Xeon 3.8,2GB Ram, Nvidia Quadra FX 3450/4000 SDI
SWorks Pro & PDMWorks 2007 SP3.0

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!


Resources