Error when retrieving List of Values Name with VBA

Hello,

I am trying to get the name of a List of Values associated with an Object.

I’m looping through my objects successfully and when I retrieve this value it is actually pulling the name of the LOV:

Dim Obj As Designer.Object
Obj.ListOfValues.Name

But this is also causing the Excel Macro to generate these errors:

Connection or SQL sentence error: (DA0005)

and

A connection required to refresh this document is unavailable. (DA0004)

I guess I don’t understand why the macro is trying to load the list of value just when I’m trying to retrieve the name of that List of Values.

Does anyone know how to get this to work?

If not, does anyone know how to tell the macro to ignore these errors?

I’ve tried this:

Private Sub xyz(…)

On Error GoTo ErrorHandler:

‘’’'CODE

ErrorHandler:
Resume Next

End Sub

But this does not ignore the error.

thanks for your help,
jeremy


jcwisu :us: (BOB member since 2008-06-20)

One of the mysteries of life! In this utility … Document a universe using Excel and the Designer SDK … I wanted to include the LOV name. I ended up just skipping it, because simply “touching” the object at all causes it to refresh … maddening :reallymad: .


Dwayne Hoffpauir :us: (BOB member since 2002-09-19)

Hi,

I found a way to prevent the refresh and the errors when displaying the name of the LOV.

Set off the interaction with the designer before touching the ListOfValues class and set it back on after.

Designer.Application.Interactive = False (use your designer application variable)
… code to get the LOV name …
Designer.Application.Interactive = True

This works for BOXI 3.1 SP3.

Regards,
Jerome


jd.pro :fr: (BOB member since 2010-11-15)

Actually, the LOV are still refreshed but I don’t have the connection error warning.


jd.pro :fr: (BOB member since 2010-11-15)

XI R2 FP2.4

I am trying to get the SQL behind a LOV using VBA or at least show if it does not parse. i.e. find LOVs that have been edited and the box ticked for do not generate before running

I have tried the method above but it won’t catch the errors even if interactive is true

    For Each Obj In DesClass.Objects
        .Cells(lRow, 2).Value = Obj.Name
        .Cells(lRow, 3).Value = Obj.Select:     If checkErrors(Obj.Select) Then .Cells(lRow, 3).Font.Color = RGB(255, 0, 0): .Cells(lRow, 5) = ErrorList
        .Cells(lRow, 4).Value = Obj.Where:      If checkErrors(Obj.Where) Then .Cells(lRow, 4).Font.Color = RGB(255, 0, 0): .Cells(lRow, 5) = .Cells(lRow, 5) & " " & ErrorList
        On Error GoTo LOVerror
        .Cells(lRow, 6).Value = Obj.ListOfValues.Name
        Obj.ListOfValues.Refresh
        GoTo LOVerrorskip
LOVerror:
        .Cells(lRow, 7).Value = .Cells(lRow, 7).Value & " --CHECK SQL"
        Resume LOVerrorskip
LOVerrorskip:
        On Error Resume Next

        lRow = lRow + 1
    Next Obj

(checkerrors is a function looking for certain characters)

any thoughts?

regards
andrew


chipdale2010 :uk: (BOB member since 2010-10-15)