I'm working through the Learning Microstation VBA book. I'm trying to connect an element to an external database so that I can assign information to it for reporting later.
The code in the text is this:
Function CreateDatabaseLink(Mslink As Long, Entity As Long, DatabaseType As MsdDatabaseLinkage, IsInformation As Boolean, DisplayableAttributeType As Long) As DatabaseLink
End Function
Sub DatabaseLinkA()
Dim myElem As Element Dim myLink As DatabaseLink Set myElem = CommandState.GetLocatedElement(True) Set myLink = CreateDatabaseLink(1, 1, msdDatabaseLinkageOleDb, True, 0) myElem.AddDatabaseLink myLink myElem.Rewrite
End Sub
with the exception that I have replaced "LinkType" in the book with "DatabaseType" - although the results are the same either way.
In both cases, I have an element selected in the drawing, and when I run DatabaseLinkA(), Microstation crashes.
Any idea what's going on?
Layne
Layne Olivo
Bentley Accredited Developer: iTwin Platform - AssociateLabyrinth Technology | dev.notes() | cad.point
Answer Verified By: Layne
Unknown said:The Debug.Assert lines are commented out because they didn't return anything
Then there's no need to comment them out!
Debug.Assert only asserts when some assumed condition goes wrong. It's a programmer's tool.
Regards, Jon Summers LA Solutions