Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Creating Backup for mdb files

JunMJunM Member Posts: 31
How can i make backup for may mdb file? pls help me. give me example. thank you very much.

Comments

  • GideonOmegaGideonOmega Member Posts: 617
    : How can i make backup for may mdb file? pls help me. give me example. thank you very much.
    :
    Here is the code I used for a program I made - :

    [code]
    Private Sub mnuUtilitysBD_Click()
    'variables for filecopy
    Dim Source, Target As String
    Dim strDate As String

    'Close database to allow copying
    MsgBox "The database will now be closed so backup can commence, If you do not see a message saying database connection reopened the restart the program", vbOKOnly + vbInformation, "Parking Tracker"
    strDate = InputBox("Please enter the date without slashes, ie May0503", "Parking Tracker - Backup")

    cnConn.Close
    Source = App.Path & "ParkingTracker.mdb"
    Target = App.Path & "BackUp Databases" & strDate & "ParkingTracker.mdb"
    FileCopy Source, Target
    'open database connection
    Set cnConn = New ADODB.Connection

    With cnConn
    .ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "ParkingTracker.mdb" & ";Persist Security Info=False"
    .Open
    End With
    MsgBox "Database connection ReOpened", vbOKOnly + vbInformation, "Parking Tracker"

    End Sub
    [/code]

    Hope it helps
    [blue]
    C:Dos
    C:Dos Run
    Run Dos Run
    [/blue]

  • JunMJunM Member Posts: 31
    : : How can i make backup for may mdb file? pls help me. give me example. thank you very much.
    : :
    : Here is the code I used for a program I made - :
    :
    : [code]
    : Private Sub mnuUtilitysBD_Click()
    : 'variables for filecopy
    : Dim Source, Target As String
    : Dim strDate As String
    :
    : 'Close database to allow copying
    : MsgBox "The database will now be closed so backup can commence, If you do not see a message saying database connection reopened the restart the program", vbOKOnly + vbInformation, "Parking Tracker"
    : strDate = InputBox("Please enter the date without slashes, ie May0503", "Parking Tracker - Backup")
    :
    : cnConn.Close
    : Source = App.Path & "ParkingTracker.mdb"
    : Target = App.Path & "BackUp Databases" & strDate & "ParkingTracker.mdb"
    : FileCopy Source, Target
    : 'open database connection
    : Set cnConn = New ADODB.Connection
    :
    : With cnConn
    : .ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "ParkingTracker.mdb" & ";Persist Security Info=False"
    : .Open
    : End With
    : MsgBox "Database connection ReOpened", vbOKOnly + vbInformation, "Parking Tracker"
    :
    : End Sub
    : [/code]
    :
    : Hope it helps
    : [blue]
    : C:Dos
    : C:Dos Run
    : Run Dos Run
    : [/blue]
    :
    :
    Thanks alot GideonOmega !!!
Sign In or Register to comment.