VBA Access Function fExistTable Code Only

This is code only. For explanation, see this post:

            VBA Access Function fExistTable Code Only
            www.vbquick.com/2011/10/microsoft-access-function-table-exists.html


Copy and paste this function (blue text) into a module from the Visual Basic Editor of your database.

Function fExistTable(strTableName As String) As Boolean
100    On Error GoTo fExistTable_err
120    Dim db As DAO.Database
130    Dim i As Integer
40    Set db = CurrentDb
150    fExistTable = False
160    db.TableDefs.Refresh
170    Application.RefreshDatabaseWindow
180    For i = 0 To db.TableDefs.Count - 1
190        If LCase(strTableName) = LCase(db.TableDefs(i).Name) Then
200             fExistTable = True
210             Exit For
220        End If
230    Next i
fExistTable_exit:
240 Set db=nothing
250    Debug.Print "fExistTable = " & fExistTable
Exit Function
fExistTable_err:
Call fncWriteError("", "Module Functions Tables", "Function fExistTable", Err.Number, Err.Description, Erl, "")
GoTo fExistTable_exit
End Function

Do you like this post? Please link back to this article by copying one of the codes below.

URL:

HTML link code:

BB (forum) link code:

No comments:

Post a Comment