Results 1 to 8 of 8
  1. #1
    AccessLes is offline Novice
    Windows 7 Access 2007
    Join Date
    Jun 2010
    Posts
    15

    Transfer Database

    Hi,
    I am trying to do the same thing as saving the Database using the Save As pull down with VBA code.

    I have looked for examples on the web but nothing comes close.

    Here's what I want to do:

    1. Transfer all the tables (structure and data), form, reports, vba code everything to another accdr not accdb file on a local pc machine.
    2. I want the user to pick the location on their local machine to save the file(I know how to do this).



    Is this doable? Is so may I see example code using
    DoCmd.TransferDatabase

    Thanks

    AccessLes

  2. #2
    is49460 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jan 2010
    Posts
    40
    Can you just copy your entire accdr file to a new location?

  3. #3
    evander is offline Competent Performer
    Windows 7 Access 2003
    Join Date
    Apr 2010
    Location
    Philippines
    Posts
    206
    Or you can create a batch script in Windows to automate this process.

  4. #4
    AccessLes is offline Novice
    Windows 7 Access 2007
    Join Date
    Jun 2010
    Posts
    15
    Great suggestions. However I am trying to do this with a Access form where the user presses a button and the file save as dialog box comes up just like if I was in the Access application.

    I just want some sample code that does the following in Access VBA:

    Open a dialog box where the user can put a filename and then click on save as.

    Its like save as for a pdf file.

    Please let me know

  5. #5
    is49460 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jan 2010
    Posts
    40
    that's exactly what I was referring to that you can copy a file using VBA code. here is a decent reference: http://www.tek-tips.com/faqs.cfm?fid=4116


    Sub CopyFile()
    Dim fso
    Dim file As String, sfol As String, dfol As String
    file = "test.xls" ' change to match the file name
    sfol = "C:\" ' change to match the source folder path
    'change the following line to get user input for destination folder
    dfol = "E:\" ' change to match the destination folder path
    Set fso = CreateObject("Scripting.FileSystemObject")
    If Not fso.FileExists(sfol & file) Then
    MsgBox sfol & file & " does not exist!", vbExclamation, "Source File Missing"
    ElseIf Not fso.FileExists(dfol & file) Then
    fso.CopyFile (sfol & file), dfol, True
    Else
    MsgBox dfol & file & " already exists!", vbExclamation, "Destination File Exists"
    End If
    End Sub


    I hope that helps.

  6. #6
    AccessLes is offline Novice
    Windows 7 Access 2007
    Join Date
    Jun 2010
    Posts
    15
    That's what I am talking about. It works great. Thanks for the help.

  7. #7
    evander is offline Competent Performer
    Windows 7 Access 2003
    Join Date
    Apr 2010
    Location
    Philippines
    Posts
    206
    How about DoCmd.Copy method?

  8. #8
    evander is offline Competent Performer
    Windows 7 Access 2003
    Join Date
    Apr 2010
    Location
    Philippines
    Posts
    206
    Sorry that was a wrong post.
    Check this out.

    http://www.tek-tips.com/faqs.cfm?fid=4116

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Transfer data to excel
    By John Southern in forum Import/Export Data
    Replies: 5
    Last Post: 06-11-2010, 09:26 AM
  2. Data transfer and Mysql
    By fsmikwen in forum Programming
    Replies: 1
    Last Post: 02-25-2010, 11:42 PM
  3. Transfer text
    By nshaikh in forum Import/Export Data
    Replies: 0
    Last Post: 09-11-2008, 03:27 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums