Results 1 to 3 of 3

Thread: coping file to a:

  1. #1

    Thread Starter
    Member
    Join Date
    Jul 2002
    Location
    CHILE
    Posts
    36

    coping file to a:

    Hi, I need to make db backup From my vbproject when db is running.

    a) it's necessary to close db before, and how is better to do that?
    b) drive a need to have free space, how I know free disk space?
    c) How can I compact database from vbcode?

    then, it's enough to make a copy?

    VB Code:
    1. [COLOR=blue]FileCopy[/COLOR]  C:\DataBase1,A:\DataBase1

    And, the last question...how I know when the copy is end, for open db again

    Thank, sorry by my english

  2. #2
    Banned Michael_Kamen's Avatar
    Join Date
    May 2001
    Location
    The Netherlands
    Posts
    1,180
    You'll have to close the database before copying yes.
    Just close the recordsets and the database.
    VB Code:
    1. RecordSet.Close
    2. Set RecordSet = Nothing
    3. Database.Close
    4. Set Database = Nothing

    To get the amount of free space:
    VB Code:
    1. Private Declare Function GetDiskFreeSpace Lib "kernel32" Alias "GetDiskFreeSpaceA" (ByVal lpRootPathName As String, lpSectorsPerCluster As Long, lpBytesPerSector As Long, lpNumberOfFreeClusters As Long, lpTtoalNumberOfClusters As Long) As Long
    2.  
    3. Private Sub Form_Load()
    4.     'KPD-Team 1998
    5.     'URL: [url]http://www.allapi.net/[/url]
    6.     'E-Mail: [email][email protected][/email]
    7.  
    8.     Dim Sectors as Long,Bytes as Long,FreeC as Long, TotalC as Long,Total as Long,Freeb as Long
    9.     'Retrieve information about the C:\
    10.     GetDiskFreeSpace "a:\", Sectors, Bytes, Freec, Totalc
    11. MsgBox "Free bytes:" + Str$(Freeb)

    What exactly do you mean with "compact" your database?

    Do you mean you want to compress it?
    That's pretty hard, in VB, I think..

  3. #3

    Thread Starter
    Member
    Join Date
    Jul 2002
    Location
    CHILE
    Posts
    36
    It's ok, but how I know when the copy is end, for open db again

Posting Permissions

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



Click Here to Expand Forum to Full Width