I'm having this problem regarding my Backup code.

I get an error saying "Permission Denied".

Here's my code:

Public Sub DBBackup()

Dim fsys As New FileSystemObject
Dim myfile As File


Dim isTrue As String
Dim isFalse As String

Set myfile = fsys.GetFile(App.Path & "\Database.mdb")


'Create Backup folder if not present
If fsys.FolderExists(App.Path & "\Backup") = False Then
    fsys.CreateFolder App.Path & "\Backup"
    
End If

isTrue = App.Path & "/Backup/" & Format$(Date, "yyyy-mm-dd")

'Replace file if existing
If fsys.FileExists(isTrue) = True Then
    fsys.DeleteFile isTrue
End If


'Start Backup Process
If myfile.Attributes = ReadOnly And myfile.ParentFolder.Attributes = ReadOnly Then
    myfile.Attributes = Normal And myfile.ParentFolder.Attributes = Normal
    
fsys.CopyFile (App.Path & "\Database.mdb"), App.Path & "\Backup", False

End If

MsgBox "Database Backup Process Complete", vbInformation, "Information"


Set fsys = Nothing

Form2.Enabled = True
Unload Me

End Sub

I don't know if it is the code or it has something to do with file/folder attributes specifically Read Only attrib.

My Database file "Database.mdb" has no set attribute's, but the folder where i want to create a backup file of my Database is set to Read Only and also the folder that contains my whole project (Includes Both of Backup folder and program).

I tried removing the Read Only attrib but it returns as soon as i look at its attrib again.

Note: i am log on as Admin on my PC

You are trying to gain user rights to a folder that is read only. Open the folder using administrator rights.

Search google on how to gain admin rights in vb6 using filesys objects.:)

You can also try solving this by removing the read only rights.

Already tried that sir. Even the one from Microsoft.

Didn't work.

Don't really know whats wrong here.

Is the folder on your hard drive or on a network drive? This might be your problem...

Fixed it.

Removed the () and add a \ on "\Backup" to be "\Backup\" on Line 32

Making me problematic for days just because of symbols, Aaarrghh.

Really don't know why this works but thanks anyway.

Going to start another topic after a minute :)

hehehe, we all went through that before, trust me.;)

it takes days just to find out that you made typo error.

Well done.