• Structure only arument (Access 2000)

    Author
    Topic
    #427657

    I use a function for copying all the tables from a database.Can i add on an argument to copy Structure Only tables?
    Below is the function i use
    Public Function ImportAllTables(DBName)
    Dim Strpassword As String
    Strpassword = “secret”
    Dim db As DAO.Database
    Set db = DBEngine.Workspaces(0).OpenDatabase(DBName, dbDriverComplete, False, “; PWD=” & Strpassword)
    Dim FrontDB As DAO.Database, BackDB As DAO.Database, Tbl As TableDef
    Set FrontDB = CurrentDb
    Set BackDB = OpenDatabase(DBName)
    For Each Tbl In BackDB.TableDefs
    If Tbl.Attributes = 0 Then
    DoCmd.TransferDatabase acImport, “Microsoft Access”, BackDB.Name, acTable, Tbl.Name, Tbl.Name
    End If
    Next
    BackDB.Close
    FrontDB.Close
    End Function

    Viewing 0 reply threads
    Author
    Replies
    • #991539

      Click in the word TransferDatabase (in the Visual Basic Editor) and press F1. You’ll see that TransferDatabase has an optional argument StructureOnly, which can be True or False:

      DoCmd.TransferDatabase acImport, “Microsoft Access”, BackDB.Name, acTable, Tbl.Name, Tbl.Name, True

    Viewing 0 reply threads
    Reply To: Structure only arument (Access 2000)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: