Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem copying mdb database using vb6

Status
Not open for further replies.

fingers

Programmer
Nov 17, 2000
17
0
0
I want to provide code to copy an mdb database from a floppy to the HD. A snippet of my code is:

data1.database.close
source="a:\abc.mdb"
destination= curdir + "\abc.mdb"
filecopy source, destination

The filecopy chokes and returns error 70 (permission denied).

I have not given any permissions when creating the database - just used the Visual Data Manager to create the db/recordsets etc.

The funny part about this is that I have another application that I've had running since June which uses the exact same code and have never had problem copying the file on a daily basis!

Incidentally, there is nothing wrong with the database, or the from/to folders. I can copy the file with no problem from MSDOS.

Anyone have any ideas? What has this dummy missed?

Thanks,

Fingers
 
I had this same problem, the reason I found out was, sometimes it takes little long to close the database connection. You are executing next command "Filecopy", before it disconnects with the database completely. As the database is in use, it is poping the error "access denied".
you cannot perform any action on database if it in already use. I have use the API Sleep to stop the execution, before the filecopy command. That way there is enough time between disconnect and Filecopy.

I hope it helps !

Thanks
 
as hujur said be sure that all connections with this database are closed
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top