VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Retrieve all data from an Access Database to a Desktop File.

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

Rate Retrieve all data from an Access Database to a Desktop File.



    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


Download this snippet    Add to My Saved Code

Retrieve all data from an Access Database to a Desktop File. Comments

No comments have been posted about Retrieve all data from an Access Database to a Desktop File.. Why not be the first to post a comment about Retrieve all data from an Access Database to a Desktop File..

Post your comment

Subject:
Message:
0/1000 characters