CRETE A BACKUP FILE



CRETE A BACKUP FILE..

Answer / 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

More Visual Basic Interview Questions

Which tool is used to configure the port range and protocols for DCOM communications?

2 Answers  


Explain about control properties?

0 Answers  


what are the Types of ActiveX Components in VB?

1 Answers  


How many File System Controls are there Explain?

0 Answers  


Are there any examples of commercial applications built using Visual Basic?

0 Answers  






What is the difference between Single and Double in VB?

4 Answers  


CONNECTIVITY OF SQL 2000 + VB USING ODBC. steps i Follow- 1) Go to Control panel-->Admintrative Tools-->Double -click Data sources(ODBC)-->click Add button-->I choose SQL server (last option), Is it right or wrong option for connecting to SQL 2000.Then a new screen appears Create a New dataSource-->in name textbox,we can write anyname--Right or wrong. suppose i enter sonia, & my server name is .,so I enter . in server & click next button-->On the Next screen i have checked the option With Sql server authentication-- >Login Id-sa, Password-->Blank-->Click next button-->Next-- >Finish-->Then I click on button Test Data source-->Mesage Comes TESTS COMPLETED SUCCESSFULLY-->OK-->OK-->Ok. These steps we have to do or not for Connectivity using ODBC. If yes,then what after these steps we have to do??Plz reply me early ??Thx in advance.

6 Answers  


Draw Sequence Modal of RDO? Explain.

0 Answers  


What is the difference between a Dynaset and Snapshot and how would you create one?

2 Answers  


What is ActiveX Control?

1 Answers   Infosys,


1s it posible to Create Tables Through Querydef?

0 Answers  


Name and define the logical tiers in a traditional 3-tiered architecture?

1 Answers  


Categories