Results 1 to 4 of 4
  1. #1
    2 Star Lounger
    Join Date
    Jun 2002
    Location
    Loudon, New Hampshire, USA
    Posts
    125
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Copy to CD (Access 2003)

    Hi All,
    I was wondering if there is a way to copy an Access Database to CD in Access. I have a client who wants to be able to push a button and have his Database, which only contains data Tables, no Queries, Forms or Reports, copied to a CD. The client does not like copying the file using copy/paste and then having to write the file to the CD. I have been reading access help, but have not found an answer. So does any one have a way to do this? Or is there some documentation I could read to help me?
    Thanks,
    Sarge

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Copy to CD (Access 2003)

    If the CD accepts direct writing of files, you could use code. But where would the button be if the database contains no forms? You could create a form with one command button, with code like this:

    Private Sub cmdCopy_Click()
    Dim fso As Object
    Dim fil As Object

    On Error GoTo ErrHandler

    Set fso = CreateObject("Scripting.FileSystemObject")
    Set fil = fso.GetFile(CurrentDb.Name)
    fil.Copy "E:" & fil.Name, True

    ExitHandler:
    Set fil = Nothing
    Set fso = Nothing
    Exit Sub

    ErrHandler:
    MsgBox Err.Description, vbExclamation
    Resume ExitHandler
    End Sub

    Replace E: with the drive letter of the CD drive.

  3. #3
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Niagara Falls, New York, USA
    Posts
    1,878
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Copy to CD (Access 2003)

    Thanks for code, will it work in A2k?

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Copy to CD (Access 2003)

    It should, unless you're on a network and the network admin has disabled scripting.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •