Hye again ,
I have problem to get Backup file .my code is bellow

Dim strB As String
'On Error Resume Next
strB = "D:\backup\db" & Date$ & ".mdb"
        FileCopy "C:\Database\MyDb.mdb", strB
    MsgBox "Backup Complete!!"

I always receive Run-time error '70' "Permission denied"
please help me

check if the path is proper (properly check for that date part in your path).

also check if any file already exists in the location by the same name.

how to make a restore file .I have already Data in MS Access i want to restore in Dababase.But i got proble.there are 256 records.When i got report in datareport these records are not arranged in sequence for example
first row is
Item ID - Item Name - Item Price
1. Juice 45.00 Rs
2. Pepsi 30.00 Rs
55. Cock 20.00 RS
290. Water 40.00 Rs
23. Milk 50.00 Rs

and so on.
all records are there but without sequence.
according to this example when i want to enter new record projects auto generate 24th ID.when i save this record. i got Primary Key Duplicate Error.
What have to do.?

I always receive Run-time error '70' "Permission denied"

Your database currently used. Close All connection before copying it.

first goto Project > Refernce from the menu bar. i the dialogue box that appears check the Windows Script Host Object Model. then use this code to copy;

Dim strB As String
Dim fs As FileSystemObject
Set fs = CreateObject("scripting.filesystemobject")

strB = "D:\backup\db" & Date$ & ".mdb"

If (fs.FolderExists("D:\backup")) Then
    fs.CopyFile "C:\Database\MyDb.mdb", strB, True
    MsgBox "Backup Complete!!" 
else
    MsgBox "Folder doesn't Exist"
End If
This article has been dead for over six months. Start a new discussion instead.