Public Function TurnOffLookup()
Dim db As DAO.Database
Dim tdf As DAO.TableDef
Dim fld As DAO.Field
Dim prp As DAO.Property
Set db = DBEngine(0)(0)
For Each tdf In db.TableDefs
If (tdf.Attributes And dbSystemObject) = 0 Then
If tdf.Connect = vbNullString And Asc(tdf.Name) <> 126 Then 'Not attached, or temp.
For Each fld In tdf.Fields
If HasProperty(fld, "DisplayControl") Then
fld.Properties("DisplayControl").Value = 109
If HasProperty(fld, "RowSourceType") Then
fld.Properties.Delete "RowSourceType"
End If
If HasProperty(fld, "RowSource") Then
fld.Properties.Delete "RowSource"
End If
If HasProperty(fld, "BoundColumn") Then
fld.Properties.Delete "BoundColumn"
End If
If HasProperty(fld, "ColumnCount") Then
fld.Properties.Delete "ColumnCount"
End If
If HasProperty(fld, "ColumnHeads") Then
fld.Properties.Delete "ColumnHeads"
End If
If HasProperty(fld, "ColumnWidths") Then
fld.Properties.Delete "ColumnWidths"
End If
If HasProperty(fld, "ListRows") Then
fld.Properties.Delete "ListRows"
End If
If HasProperty(fld, "ListWidth") Then
fld.Properties.Delete "ListWidth"
End If
If HasProperty(fld, "LimitToList") Then
fld.Properties.Delete "LimitToList"
End If
End If
Next
End If
End If
Next
Set prp = Nothing
Set fld = Nothing
Set tdf = Nothing
Set db = Nothing
End Function
Public Function HasProperty(obj As Object, strPropName As String) As Boolean
'Purpose: Return true if the object has the property.
Dim varDummy As Variant
On Error Resume Next
varDummy = obj.Properties(strPropName)
HasProperty = (Err.Number = 0)
End Function