Access/DAOを使ってテーブル名の一覧を取得する

Option Compare Database
Option Explicit
Const MYObjName As String = "modGet_TableNameDAO"

'概要:DAOを使用してテーブル名一覧を“;”区切りで返す。
'履歴:H18.11.10    初版
Public Function get_TableNameDAO() As String
Dim mbTitle As String
Dim DBS As DAO.Database
Dim TDF As DAO.TableDef
Dim strTableName As String
    
    mbTitle = MYObjName & "/get_TableNameDAO"
    strTableName = ""
    Set DBS = CurrentDb
    For Each TDF In DBS.TableDefs
        If Left(TDF.Name, 4) <> "MSys" Then strTableName = strTableName & ";" & TDF.Name
    Next TDF
    If Left(strTableName, 1) = ";" Then strTableName = Mid(strTableName, 2)
    get_TableNameDAO = strTableName
    
Exit_get_TableNameDAO:
    Set DBS = Nothing
    Exit Function
    
Err_get_TableNameDAO:
    MsgBox Err.Number & "/" & Err.Description, vbCritical, mbTitle
    Resume Exit_get_TableNameDAO
End Function