Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

MS Access VBA & QV Api

Hi,

Within MS Access I am trying to get a list of all fields (read field objects) in a QlikView document. I assume this should be pretty straightforward by looping through the Document.Fields, but cannot get it to work.

I have tried through the Document.GetFieldDescriptions, but for some reason I cannot get a grab on the datatype returned by this function.

Has anybody ever done this?

Regards,

888 SP5

3 Replies
Anonymous
Not applicable
Author

Do you need to do something with this in the script?

If you want to display them in the front end, there's a system field called $Field.

Right click on the sheet and choose "Select fields.." and then check the "Show System Fields" checkbox.

Not applicable
Author

I need to get all the field objects so I can get properties for all fields.

Something like:

objCol = m_objDoc.GetFieldDescriptions

For i = 0 To m_objDoc.GetFieldCount - 1

    Set oTMP = objCol.Item(i)

    Debug.Print oTMP.Name

    Debug.Print oTMP.GetLocked

Next

Not applicable
Author

Found something that works. I wonder whether there is a cleaner approach than going through the descriptions to get actually to the field collection.

Public Sub LoadFields(objDocument As QVDocument)

     Dim colFld As Object

     Dim objFld As Object

     Dim i As Integer

     Set colFld = objDocument.GetFieldDescriptions

     For i = 0 To colFld.Count - 1

         Set objFld = objDocument.GetField(colFld.Item(i).Name)

         m_colFld.Add objFld, CStr(objFld.Name)

     Next

     Set colFld = Nothing

     Set objFld = Nothing

End Sub