• TransferDatabase (Access 2000)

    Author
    Topic
    #1771532

    My Acccess database is split into a codes-only front-end, and a data-only back-end. For use on a legacy dBase III+ program, I need to export a table in the back-end to a dBase III+ file.

    I use the following code:

    DoCmd.TransferDatabase acExport, “dBase III”, “Backend_Path:Backend.mdb”, acTable, “tblBackEnd”, “dB3_File.dbf”

    I got the error message that “Backend_Path:Backend.mdb” was not a valid path. However, if the table was created in the front-end, and “Backend_Path:Backend.mdb” was replaced by “Frontend_Path:FrontEnd.mdb” or just the front-end path, DoCmd.TransferDatabase worked fine and the dBase file was correctly created. However, I would prefer the table stays in the back-end.

    Does it mean that acExport in DoCmd.TransferDatabase works only with tables present in the front-end?

    Please help.

    Viewing 0 reply threads
    Author
    Replies
    • #1808711

      When you are exporting to DBase, the 3rd argument to DoCmd.TransferDatabase is the path (folder) of the file to be exported. It is not the name of an Access database; DoCmd.TransferDatabase can only export from the currently active database. You can, however, create a link in your frontend to the table in the backend. Exporting the link from the frontend will have the same effect as exporting the table itself from the backend. The alternative would be to create a second instance of Access in code, open the backend database in it. and export the table.

      • #1808773

        Thanks HansV for your reminder on TransferDatabase. I have to accept the newly created table into my front-end One of the reasons is I have to rename some of the fields to be used in the legacy application before TrenasferDatabase, and it is easier to do so in the active database.

        The main reason I don’t want to touch my front-end is to prevent it from bloating up. I can compact and repair the back-end from my front-end, but I can’t do the same to my front-end without doing it externally.

        • #1808775

          As I mentioned, you could start a second instance of Access using Automation, and open the backend database in it as current database. You can do everything in the backend.

          Dim app As Access.Application
          Set app = CreateObject(“Access.Application”)
          app.OpenCurrentDatabase “path-and-name-of-backend”

          app.DoCmd.TransferDatabase …
          app.Quit
          Set app = Nothing

    Viewing 0 reply threads
    Reply To: TransferDatabase (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: