Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

back up database periodically...

Status
Not open for further replies.

sn00pies

Programmer
Jun 30, 2006
12
MY
i am using VB to backup my database(access), as my VB form has 2 combo
boxes(month and year) to allow user to select which month to back up
thier database... once the user select periodically, it will back up
the
database.mdb into particular folder which i am using FSO to locate.
What solution i need to find out is i want to back up several database
accordingly to the month the user selects... i.e from January to april,
it
will grab 3 files for each month which is january, february and March.
And each will be renamed as 1.mdb, 2.mdb and 3.mdb . Please eliminate
the month of
April because i still want the record remains once the user select till
that month. Roughly navigate me pls...
 
Maybe something like this would help?

Code:
Private Sub BackupDatabaseYearTillNow(iLastMonthToBackup As Integer)
    'Subroutine that Receives sLastMonthToBackUp as an Integer
    'i.e. April = 4, June = 6
    
    Dim iLoop As Integer
    
    For iLoop = 1 To iLastMonthToBackup
        
        'Copy and Rename the File to the BackupDirectory
        FileCopy sFullPath & iLastMonthToBackup & "2006.mdb", _
            sBackupDirectoryPath & iLastMonthToBackup & ".mdb"
        
        'This is an example, you will have to replace the
        'sFullPath and sBackupDirectoryPath Variables with your own
        'or assign your own values to them before calling.
        'Also The first part of the FileCopy statement needs to be
        'adjusted to find your Current Database based on its name.
    Next iLoop
    
End Sub

yosherrs.gif

[tt]'Very funny, Scotty... Now Beam down my clothes.'[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top