Answer Posted / haiipl25
Open a project which have one text box name as 'txtbackup' &
one command button name as 'cmdBackup'. After that, put the
following code for Back up the file which is present in that
current folder with the name sample.mdb
Dim obj As Object
Dim path As String
Dim j As Integer
Dim b As String
Dim a(100) As String
Dim i As Integer
If txtbackup <> "" Then
'******************************************
Dim c, c1 As String
i = 0
c = txtbackup.Text
For j = 1 To Len(c)
c1 = Mid(c, j, 1)
If c1 <> "\" Then
a(i) = a(i) & c1
Else
i = i + 1
End If
Next
'*******************************************
Set obj = CreateObject("Scripting.FileSystemObject")
path = txtbackup.Text
b = a(0)
'**** Folder Creation ****
Dim fso As New FileSystemObject
For j = 1 To i
b = b & "\" & a(j)
If Not fso.FolderExists(b) Then
obj.CreateFolder (b)
End If
Next
'**** File Creation ****
If Not fso.FileExists(path & "\sample_" & Format$(Date,
"dd_mm_yy") & ".mdb") Then
obj.CopyFile "" & App.path & "\sample.mdb", "" & path &
"\sample_" & Format$(Date, "dd_mm_yy") & ".mdb"
MsgBox "Data Base Successfuly Back Up in Loction :" & path
& " ", vbInformation, "Back Up"
Else
If MsgBox("Data Base is already exists. Do u want to
replace it?", vbQuestion + vbYesNo, "Confirmation") = vbYes Then
obj.CopyFile "" & App.path & "\sample.mdb", "" & path &
"\sample_" & Format$(Date, "dd_mm_yy") & ".mdb"
MsgBox "Data Base Successfuly Back Up in Loction :" & path
& " ", vbInformation, "Back Up"
End If
End If
Else
MsgBox "Enter the Destination Path.....", vbExclamation
End If
txtbackup.Text = ""
txtbackup.SetFocus
End Sub
Is This Answer Correct ? | 10 Yes | 0 No |
Post New Answer View All Answers
What type of databases you can access through ADO Data Access Object?
by writing MACRO CODE,i want to retrive data from one spead sheet to another UI (workbook). control will search cell by cell for each row and load the data in another workbook(UI). ex: custdetails custname lastname locaton mobile pincode custdetails raj tony hyd 555555 521245 servcreqrd srvce# srvcename location srvcepincode servcreqrd 754 drilling hyd 521784 for the above example in the another workbook retrive data like this custname Raj srvce# 754 srvcepincode 521784. while retrieving data control will search cell by cell for each row.
How do I change the color of a form in visual basic?
what are the Parts of ODBC?
How many objects resides in ADO ?
what are the Types of cursors in RDO?
How can I call a 'hidden' DOS program from VB?
How can I change the printer Windows uses in code without using the print common dialog? How can I change orientation?
How do you create a form in visual basic?
How would you create properties by using class Builder Wizard?
Is it possible to change menu runtime using API? If yes Specify the function names?
Is it possible to Manipulate data through flexgrid? Explain.
__ no of controls in form.
What is instantiating?
Explain about control properties?