Last active
July 28, 2020 02:26
-
-
Save facebookegypt/0c740d2124901b5aa1f81aea64addc2f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Imports dao | |
Module DaoConnection | |
Public Sub ConnectAsDAO() | |
Dim Attrib As String | |
Dim prpLoop As dao.Property | |
Dim DBEngin As New Microsoft.Office.Interop.Access.Dao.DBEngine | |
Dim wrkMain As Microsoft.Office.Interop.Access.Dao.Workspace = DBEngin.Workspaces(0) | |
Dim dbsPubs As Database = _ | |
wrkMain.OpenDatabase("C:\Databases\db.accdb", False, False, ";pwd=MyPassword") | |
Dim tBldef As TableDef | |
For I As Integer = 0 To dbsPubs.TableDefs.Count - 1 | |
tBldef = dbsPubs.TableDefs(I) | |
Attrib = (tBldef.Attributes And -2147483646) | |
If Attrib = 0 Then | |
For Each prpLoop In tBldef.Properties | |
Try | |
Debug.WriteLine(" " & prpLoop.Name & " - " & | |
IIf(IsNothing(prpLoop), "[empty]", prpLoop.Value)) | |
Catch ex As Exception | |
Debug.WriteLine(prpLoop.Name) | |
End Try | |
Next | |
'Debug.WriteLine(tBldef.Name) | |
Dim fldLoop As Fields = tBldef.Fields | |
For Each fldloop1 As dao.Field In fldLoop | |
Debug.WriteLine("Table::" & tBldef.Name & "::Field::" & fldloop1.Name) | |
Next | |
End If | |
Next | |
dbsPubs = Nothing | |
tBldef = Nothing | |
DBEngin = Nothing | |
End Module |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment