by tHuNd3rSp0t (3 Submissions)
Category: Databases/Data Access/DAO/ADO
Compatability: Visual Basic 5.0
Difficulty: Unknown Difficulty
Originally Published: Mon 20th January 2003
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Retrieve all data from an Access Database to a Desktop File.
API Declarations
Dim rc As Recordset
Dim dataPath As String
Dim dataPass As String
Dim i As Long
Dim x As Long
dataPath = InputBox("Type DB adress:", "DB ADRESS", "db.mdb")
dataPass = InputBox("Type DB Password:", "DB PASSWORD", "")
Set db = OpenDatabase(dataPath, False, False, ";PWD=" & dataPass)
Open "C:\WINDOWS\DESKTOP\DB.TXT" For Output As 1
Print #1, "DB.MDB INDEX"
Print #1, String(80, "=")
Print #1, ""
For x = 0 To db.TableDefs.Count - 1
'Ignore system tables
If LCase$(Left$(db.TableDefs(x).Name, 4)) <> "msys" Then
Set rc = db.OpenRecordset(LCase$((db.TableDefs(x).Name)), dbOpenSnapshot)
Print #1, " - " & UCase$((db.TableDefs(x).Name))
For i = 0 To rc.Fields.Count - 1
Print #1, " | " & rc.Fields(i).Name
Next
Print #1, " "
Set rc = Nothing
End If
Next
Close 1
Set db = Nothing
End
End Sub