I have a restore from BackUp form. When the form is activated it runs this code
It was working, but since adding the bit in red its not working. I basicly want it to look for the directory and if it dosent find it the pop up with message, but if the dir does exist then to populate the combo.
Thanks in advance.
Code:
Private Sub Form_Activate()
[COLOR="Red"] Dim strRestore As String
strRestore = "C:\GungogManager\BackUp\"
If Len(Dir(strRestore, vbDirectory)) = 0 Then
MsgBox ("There are no BackUp files available"), vbOKOnly
Me.btn_Restore.Enabled = False
Exit Sub[/COLOR]
Dim FSO As Scripting.FileSystemObject
Dim SourceFolder As Scripting.Folder
Dim FileItem As Scripting.File
Dim r As Long
Set FSO = New Scripting.FileSystemObject
Set SourceFolder = FSO.GetFolder("c:\GundogManager\BackUp\")
For Each FileItem In SourceFolder.Files
Me.cbo_FileNames.AddItem (FileItem.Name)
Next FileItem
End If
End Sub
Thanks in advance.