get a list of domains from a feature dataset (geodatabase)

Discussion created by sargon.chan on Aug 18, 2010
Latest reply on Aug 18, 2010 by sargon.chan
Hi, Folks.
I am trying to get a listing of domains using VBA.
If there is no domain defined, then print an 'empty' message.
My original code:

For i = 0 To pFirstLayerFields.FieldCount - 1
    Set pDomain = pFirstLayerFields.Field(i).Domain
    If IsNull(pDomain.Name) Then
       Print #1, "empty"
       strFieldName = pDomain.Name
       Print #1, strFieldName
    End If

I got an Run-time error '91' - 'Object variable or With block variable not set'
Obviously it hits a field without any domain defined
when I changed Set pDomain = pFirstLayerFields.Field(i).Domain
to                   Set pDomain = pFirstLayerFields.Field(11).Domain

which I know I have a domain defined, the program ran perfectly, of course, it gave me a long list
of the same domain of field(11).

How to check on a field without domain and then skip and until eventually have a list of domains.
The FC is on a geodatabase and I do not want to have all the domains from the whole geodatabase.
I just need from a specific FC.