Hello everyone. I am making a form to backup my Ms-Access database in vb 6.0. I have a textbox (txtdestination) a progress bar (progstat) a command button (cmdbackup) and a few labels to show different info. I have the following code in my backup form :
Dim mintCount As Integer, mintPause As Integer
Dim dbasize As Long
Dim PathName As String
Private Sub cmdbackup_Click()
If txtDestination <> "" Then
FileCopy PathName, txtDestination
lblCount.Visible = True
lblInform.Visible = True
' lblCBK.Visible = True
progStat.Visible = True
progStat.Value = progStat.Value + 2
CountMe
'If the Progress Bar (ProgLoad) is 100% then your function happens.
If progStat.Value = 100 Then
MsgBox "Backup database complete", vbInformation
Unload Me
Else
If txtDestination = "" Then
progStat.Value = 0
'Your function, can be anything. Open another form, frmMain.show... Ect.
End If
End If
End If
End Sub
Private Sub cmdCancel_Click()
Unload Me
End Sub
Private Sub Form_Activate()
lblSize = Format((dbasize / 1024) / 1024, "standard") & "MB."
End Sub
Private Sub cmdDestination_Click()
Me.commdg.Filter = "*.mdb"
Me.commdg.ShowSave
Dim strTemp As String
strTemp = Me.commdg.FileName & ".mdb"
If strTemp <> "" Then
txtDestination = strTemp
End If
End Sub
Private Sub Form_Load()
PathName = App.Path & "\main.mdb"
dbasize = FileLen(PathName)
End Sub
Private Sub CountMe()
mintPause = mintPause + 1
If mintCount < 0 Then
mintCount = mintCount + 1
lblCount.Caption = "(" & mintCount & "%)..."
' frmSplash.Refresh
ElseIf mintCount < 100 Then
mintCount = mintCount + 2
lblCount.Caption = "(" & mintCount & "%)..."
' frmSplash.Refresh
End If
If mintPause = 100 Then
lblCount.Caption = "App..."
lblInform.Caption = "Starting"
ElseIf mintPause > 180 Then
Unload Me
End If
End Sub
The problem is when I clicked cmbbackup the backup is created as per txtdestination and the progressbar stands in 2%, its not completing 100%, I don't have any clued. Why this is not completing to 100% ? Any help plz.