Ellis,

How unobservant of me – I love it (similar to my EssKayKay but much better).

After keying in any label (duplicate or not) and clicking Update, I receive an error:

“Compile error: variable not defined”
on “Public Function dynExecuteSQL(ByVal pstrSQL As String) As Boolean”

I believe I have removed all my error handling.


Following is what/how I modified the code:
Code:
sUpdate = sUpdate + " where MSLink = " + lblMSLinkID.Caption
Set obj1 = New Class1
    
    'Here's where the MicroStation Duplicate Error will occur (between MsgBox 1 & 2)
    'MsgBox "1"
'obj1.dynExecute = sUpdate
    'MsgBox "2"

'--- added per vbforms 02-18-2010 ----
If obj1.dynExecuteSQL(sUpdate) Then
    ' Error adding to table (probably a duplicate Label)
    Set obj1 = Nothing
    Exit Sub
End If
'-------------------------------------

Set obj1 = Nothing

Where Error occurs:
Code:
Public Function dynExecuteSQL(ByVal pstrSQL As String) As Boolean
'added per suggestion on vbforms.net 02-02-2010

On Error GoTo dynExecuteSQLErr
    Dim cmd1 As New ADODB.Command

    Set cmd1.ActiveConnection = cn1
    cmd1.CommandText = sSQL
    cmd1.Execute

dynExecuteSQLExit:
    Set cmd1 = Nothing
    Exit Function
    
dynExecuteSQLErr:
    dynExecuteSQL = True
    Select Case Err.Number
        Case -2147467259: MsgBox "Duplicate Label exits - please re-enter..."
        Case Else: MsgBox Err.Description
    End Select
    Resume dynExecuteSQLExit
End Function
Thanks,
SKK