Field_OnLookUp Event

This event occurs when a field is marked as a look-up field and the user interacts with the device to request additional values for that field value.

Field_OnLookUp ( Form , FieldName , FieldValue )
Argument Description
Form The form object.
FieldName The name of the field that requires lookup.
FieldValue The value of the field that requires lookup.

Remarks

You can use this event to perform tasks such as looking up field values based on the user input on a form.  If the return value is empty string then the look-up has been successful.

Example

Function Field_OnLookUp(Form, FieldName, FieldValue)
  Form.TraceMsg "Field_OnLookUp"
  Dim rootDSE, domainObject
  Set rootDSE = GetObject("LDAP://RootDSE")
  DomainContainer = rootDSE.Get("defaultNamingContext")
  Set conn = CreateObject("ADODB.Connection")
  conn.Provider = "ADSDSOObject"
  conn.Open "ADs Provider"
  nickname = Value & "*"
  ldapStr = "<LDAP://" & DomainContainer & ">;(& (mailnickname=" & nickname & ")(|(&(objectCategory=person)(objectClass=user)(!(homeMDB=*))(!(msExchHomeServerName=*)))(&(objectCategory=person)(objectClass=user)(|(homeMDB=*)(msExchHomeServerName=*)))));adspath;subtree"
  Set rs = conn.Execute(ldapStr)
  While Not rs.EOF
    Set oUser = GetObject(rs.Fields(0).Value)
    For Each email In oUser.proxyAddresses
      If InStr(email, "SMTP:") = 1 Or InStr(email, "smtp:") = 1 Then
        Form.Fields.Field(Name).AddListItem Right(email, Len(email) - 5),Right(email, Len(email) - 5)
      End If
    Next
    rs.MoveNext
  Wend
End Function