Account Options

  1. Sign in
The old Google Groups will be going away soon.
Switch to the new Google Groups.
Google Groups Home
« Groups Home
How copy a file
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  6 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Alberto Rausa  
View profile  
 More options Feb 17 1998, 3:00 am
Newsgroups: comp.databases.ms-access
From: ara...@galactica.it (Alberto Rausa)
Date: 1998/02/17
Subject: How copy a file

Can i copy a file from VBA and Access2?

Thank!

                        Alberto Rausa


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Dev Ashish  
View profile  
 More options Feb 19 1998, 3:00 am
Newsgroups: comp.databases.ms-access
From: "Dev Ashish" <das...@hotmail.com>
Date: 1998/02/19
Subject: Re: How copy a file

Hi,

Try the article Q102671 in Microsoft's Support site.

btw it's called Access Basic in version 2.0,  not VBA.

HTH
--
Just my $.001
Dev Ashish
---------------
The Access Web ( http://home.att.net/~dashish )
---------------

Alberto Rausa wrote in message <34e9b922.6050...@news.tin.it>...

:Can i copy a file from VBA and Access2?
:
:Thank!
:
: Alberto Rausa

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
D Paul Phillips  
View profile  
 More options Feb 19 1998, 3:00 am
Newsgroups: comp.databases.ms-access
From: D Paul Phillips <dpphi...@mail.delcoelect.com>
Date: 1998/02/19
Subject: Re: How copy a file

Alberto Rausa wrote:

> Can i copy a file from VBA and Access2?

> Thank!

>                         Alberto Rausa

Yes you can! Example Below:

               Dim SourceFile As String
                Dim DestinationPath As String
                Dim MyFile As String
                Dim Message As String

            CommonDialog1.Flags = &H1000 Or &H4
            CommonDialog1.DialogTitle = "Copy Template"
            CommonDialog1.InitDir = [Forms]![Admin Menu]![PTH]
            CommonDialog1.FileName = "*.doc"
            CommonDialog1.Filter = "Word 7.0 Document (*.doc)|*.doc"
            CommonDialog1.ShowSave
            CommonDialog1.DefaultExt = "doc"
            SourceFile = CommonDialog1.FileName
            DestinationPath = CommonDialog1.FileTitle
            MyFile = Dir([Forms]![Admin Menu]![PTH] & DestinationPath)
                If MyFile = CommonDialog1.FileTitle Then
                     Message = CommonDialog1.FileTitle & " already
exists in this directory. Overwrite?"
                     If MsgBox(Message, vbYesNo, "Error!") = vbYes Then
                     On Error Resume Next
                     [Forms]![Categories]![TestFileName] =
CommonDialog1.FileTitle
                     FileCopy SourceFile, [Forms]![Admin Menu]![PTH] &
DestinationPath
                     DoCmd.Close acForm, "Categories", acSaveYes
                     Else
                      DoCmd.DoMenuItem acFormBar, acEditMenu, acUndo, ,
acMenuVer70
                     End If
                Else
                    On Error Resume Next
                    If CommonDialog1.FileTitle <> "" Then
                        [Forms]![Categories]![TestFileName] =
CommonDialog1.FileTitle
                        FileCopy SourceFile, [Forms]![Admin Menu]![PTH]
& DestinationPath
                        DoCmd.Close acForm, "Categories", acSaveYes
                        Else
                    End If
                End If


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jürg Wild  
View profile  
 More options Feb 20 1998, 3:00 am
Newsgroups: comp.databases.ms-access
From: "Jürg Wild" <w...@logon.ch>
Date: 1998/02/20
Subject: Re: How copy a file

just use the access statement

filecopy source, dest


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Michael Kaplan  
View profile  
 More options Feb 22 1998, 3:00 am
Newsgroups: comp.databases.ms-access
From: "Michael Kaplan" <v-mic...@email.msn.com>
Date: 1998/02/22
Subject: Re: How copy a file

This is a great A96/A97 solution.... but it will not work in Access 2....

Michael

D Paul Phillips <dpphi...@mail.delcoelect.com> wrote in message
news:34EC8DAA.4CA6@mail.delcoelect.com...


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Trevor Best  
View profile  
 More options Feb 26 1998, 3:00 am
Newsgroups: comp.databases.ms-access
From: nos...@easynet.co.uk (Trevor Best)
Date: 1998/02/26
Subject: Re: How copy a file

On Tue, 17 Feb 1998 16:22:37 GMT in comp.databases.ms-access,

ara...@galactica.it (Alberto Rausa) wrote:
>Can i copy a file from VBA and Access2?

Sub CopyFile (pstrSrc As String, pstrTarget As String)
    On Error GoTo CopyFile_Err
    Dim hfInput As Integer
    Dim hfOutput As Integer
    Dim lngFilePointer As Long
    Dim lngRemain As Long, lngFileLen As Long
    Dim strBuffer As String
    Dim J As Integer
    Dim varDummy As Variant

    ' Size of buffer to use while copying
    Const BYTE_SIZE = 20480
    DoCmd Hourglass True
    hfInput = FreeFile

    ' open source file
    Open pstrSrc For Binary Access Read Shared As #hfInput
    hfOutput = FreeFile
    If Len(Dir(pstrTarget)) Then
        ' Overwrite tartget if exists
        Kill pstrTarget
    End If
    Open pstrTarget For Binary Access Read Write Lock Read Write As
#hfOutput

    ' Length of file
    lngRemain = LOF(hfInput)
    lngFileLen = lngRemain
    varDummy = SysCmd(SYSCMD_INITMETER, "Copying", lngFileLen)
    lngFilePointer = 1
    Do Until lngRemain < BYTE_SIZE
        strBuffer = Input(BYTE_SIZE, #hfInput)
        Put #hfOutput, lngFilePointer, strBuffer
        lngRemain = lngRemain - BYTE_SIZE
        lngFilePointer = lngFilePointer + BYTE_SIZE
        varDummy = SysCmd(SYSCMD_UPDATEMETER, lngFilePointer)
        DoEvents
    Loop
    strBuffer = Input(lngRemain, #hfInput)
    Put #hfOutput, lngFilePointer, strBuffer
    lngFilePointer = lngFilePointer + lngRemain
    varDummy = SysCmd(SYSCMD_UPDATEMETER, lngFilePointer)
    DoEvents
    Close #hfInput
    Close #hfOutput

CopyFile_Exit:
    On Error Resume Next
    Close #hfInput
    Close #hfOutput
    DoCmd Hourglass False
    varDummy = SysCmd(SYSCMD_REMOVEMETER)
    Exit Sub

CopyFile_Err:
    Select Case Err
        Case Else
    End Select

    ' Retry/Abort/Ignore
    Select Case MsgBox(Error, MB_ABORTRETRYIGNORE Or MB_ICONEXCLAMATION,
"Error " & Err)
        Case IDABORT
            Resume CopyFile_Exit
        Case IDRETRY
            Resume
        Case IDIGNORE
            Resume Next
    End Select
    Exit Sub
End Sub

                    \|||/
                    /   \
                   C o o D
-----------------ooO--u--Ooo-------------------------------
To reply my mail, replace the "nospam" in my address with "trevor",
this was put on in defence of the spam robots that roam usenet.

MS Access FAQ now available on my site below.
http://easyweb.easynet.co.uk/~trevor/

Apathy Error: Don't bother striking any key.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »