Hi Guys!
I’m struggling to link my Custom Properties with a table of MS Access
Linking Means Pasting the details from Access to Custom Properties.
For Eg: If I have a model No: 500 is open in solidworks , I need the codes that will search that Part Number in that table and update the corresponding Properties in Custom Properties.
Please support.
(Please find an attachment of the Pick and Database)
Similar Code for Excel, but unable to connect with Access DB
.............................................................................................................................................................
Dim swApp As SldWorks.SldWorks
Dim excApp As Excel.Application
Dim swModel As SldWorks.ModelDoc2
Dim swCustPrpMgr As SldWorks.CustomPropertyManager
Sub main()
Set swApp = Application.SldWorks
Set swApp = Application.SldWorks
Set excApp = GetObject(, "Excel.Application")
Set swModel = swApp.ActiveDoc
Set swCustPrpMgr = swModel.Extension.CustomPropertyManager("")
Dim excRange As range
Dim excSheet As Excel.Worksheet
Set excSheet = excApp.ActiveSheet
Set excRange = excSheet.range(excApp.Cells(1, 1), excApp.Cells(1000, 1))
Dim searchRes As range
Dim name As String
Dim index As Integer
Dim title As String
title = swModel.GetTitle()
index = InStr(title, ".")
name = Left(title, IIf(index = 0, Len(title), index - 1))
Set searchRes = excRange.Cells.Find(name)
If Not searchRes Is Nothing Then
LinkPrpToCell searchRes.row, 1, "EPMPartNumber"
LinkPrpToCell searchRes.row, 2, "EPMPartName"
LinkPrpToCell searchRes.row, 3, "EPMDescription"
LinkPrpToCell searchRes.row, 4, "EPMMaterialReference"
LinkPrpToCell searchRes.row, 5, "Density"
LinkPrpToCell searchRes.row, 6, "EPMMaterial"
Dim density As Double
density = CDbl(excApp.Cells(searchRes.row, 5).value * 1000000)
swModel.Extension.SetUserPreferenceDouble swUserPreferenceDoubleValue_e.swMaterialPropertyDensity, swUserPreferenceOption_e.swDetailingNoOptionSpecified, density
MsgBox "Properties Updated"
Else
MsgBox "Failed"
End If
End Sub

If you are working on your own program and have specific issues, please be more precise.
If you are looking for a daily-use, production-ready macro I think what you are asking for is beyond the scope of free help on a forum. This situation, while extremely useful, is also extremely boring to write. If it's going to be used by multiple people, you need someone to work with you and make sure that the process works well with your workflow. You probably need to pay someone to write it for you or research the billions of examples online of how to get custom properties and how to use ADO to interact with an Access database.
Looking at the database you supplied it just has the Materialand Density. Are you using a SW Material Database?
I would like to know the main goal here . Are you trying to import to or export from the DB, or something else?
if your are exporting I've done that and can help you
importing sould be about the same