Returns a list of all tables that contain a field with the given name
Returns a list of all tables that contain a field with the given name
Rate Returns a list of all tables that contain a field with the given name
(1(1 Vote))
'*******************************************************
'FindFieldInTables
' Searches through the database and returns
' a list of all the tables containing
' the named field. The list is delimited
' using the specified delimeter.
'*******************************************************
Public Function FindFieldInTables(FldName As String, Optional Delimeter As String = vbCrLf) As String
Dim tdf As TableDef, fld As Field, res As String
If FldName = "" Then Exit Function Else FldName = Trim(FldName)
For Each tdf In CurrentDb.TableDefs
For Each fld In tdf.Fields
If StrComp(fld.Name, FldName, vbTextCompare) = 0 Then
res = res & tdf.Name & Delimeter
End If
Next
Next
'strip off trailing delimeter when returning result
If Len(res) > 1 Then
FindFieldInTables = Left(res, Len(res) - Len(Delimeter))
End If
End Function
Returns a list of all tables that contain a field with the given name Comments
No comments yet — be the first to post one!
Post a Comment