Public Sub PrintAllObjectsBySysTable(ByRef db As DAO.Database)
Dim sql As String
Dim rs As DAO.Recordset
'Table
Debug.Print "----- Table -----"
sql = "SELECT Name FROM MsysObjects WHERE Left([Name],4) <> ""Msys"" AND Type = 1 ORDER BY Name;"
Set rs = db.OpenRecordset(sql)
Do Until rs.EOF
Debug.Print rs!name
rs.MoveNext
Loop
'Query
Debug.Print "----- Query -----"
sql = "SELECT Name FROM MsysObjects WHERE Left([Name],1) <>""~"" AND Type = 5 ORDER BY Name;"
Set rs = db.OpenRecordset(sql)
Do Until rs.EOF
Debug.Print rs!name
rs.MoveNext
Loop
'Form
Debug.Print "----- Form -----"
sql = "SELECT Name FROM MsysObjects WHERE Type = -32768 ORDER BY Name;"
Set rs = db.OpenRecordset(sql)
Do Until rs.EOF
Debug.Print rs!name
rs.MoveNext
Loop
'Report
Debug.Print "----- Report -----"
sql = "SELECT Name FROM MsysObjects WHERE Type = -32764 ORDER BY Name;"
Set rs = db.OpenRecordset(sql)
Do Until rs.EOF
Debug.Print rs!name
rs.MoveNext
Loop
'Macro
Debug.Print "----- Macro -----"
sql = "SELECT Name FROM MsysObjects WHERE Type = -32766 ORDER BY Name;"
Set rs = db.OpenRecordset(sql)
Do Until rs.EOF
Debug.Print rs!name
rs.MoveNext
Loop
'Module
Debug.Print "----- Module -----"
sql = "SELECT Name FROM MsysObjects WHERE Type = -32761 ORDER BY Name;"
Set rs = db.OpenRecordset(sql)
Do Until rs.EOF
Debug.Print rs!name
rs.MoveNext
Loop
End Sub
コメント