LookupField Property

Microsoft FrontPage Visual Basic

LookupField Property

Returns a ListField object that defines the field on which to perform a search.

expression.LookupField

expression    Required. An expression that returns a ListFieldLookup object.

Example

The following example creates a new field of type fpFieldLookup and displays the name of the new field and the name of the field that is being searched.

    Sub CreateLookup()
'Adds new Lookup field

    Dim objApp As FrontPage.Application
    Dim objLstFlds As listFields
    Dim objFldLookup As ListFieldLookup
    Dim ObjField As ListField
    Dim strName As String

    Set objApp = FrontPage.Application
    Set objLstFlds = objApp.ActiveWeb.Lists.Item(0).Fields
    strName = "NewFileLookupField"
    'Add new Field of type fpFieldLookup to list
    objLstFlds.Add Name:=strName, Description:="New Lookup Field", _
                   Fieldtype:=fpFieldLookup
    Set objFldLookup = objLstFlds.Item("NewFileLookupField")
    MsgBox "A new field named " & strName & " was added to the list " & _
           objApp.ActiveWeb.Lists.Item(0).Name & ". The field used for the " & _
           "lookup is " & objFldLookup.LookupField.Name & "."

End Sub