|
-
Jun 21st, 2005, 08:12 AM
#1
[Resolved] Permission Denied - FileCopy
Last edited by kfcSmitty; Jun 21st, 2005 at 09:17 AM.
-
Jun 21st, 2005, 08:20 AM
#2
Frenzied Member
Re: Stupid Question -- App.Path
Try this:
Code:
MsgBox (Application.Path)
Blessings in abundance,
All the Best,
& ENJOY!
Art . . . . Carlisle, PA . . USA
-
Jun 21st, 2005, 08:24 AM
#3
Re: Stupid Question -- App.Path
Application does not support .Path
-
Jun 21st, 2005, 08:37 AM
#4
Frenzied Member
Re: Stupid Question -- App.Path
It does in Excel. What application are you using?
Blessings in abundance,
All the Best,
& ENJOY!
Art . . . . Carlisle, PA . . USA
-
Jun 21st, 2005, 08:39 AM
#5
Re: Stupid Question -- App.Path
Oh yeah, sorry. I'm using Access 2002
-
Jun 21st, 2005, 08:47 AM
#6
Re: Stupid Question -- App.Path
I have it working with
VB Code:
FileCopy Application.CurrentProject.FullName, strDBLocation
but it keeps saying permission denied now :/
-
Jun 21st, 2005, 08:54 AM
#7
Re: Stupid Question -- App.Path
First, you need a backslash before the source location.
VB Code:
FileCopy app.Path & "\FinancialData.mdb", strDBLocation
Second, FileCopy is going to want the name of the file. In other words, if we weren't using a variable, the copy would look like
VB Code:
FileCopy "c:\folder\FinancialData.mdb", "c:\otherfolder\FinancialData.mdb"
Does strDBLocation contain the new folder path AND the db name?
-
Jun 21st, 2005, 08:55 AM
#8
Re: Permission Denied - FileCopy
yes, if I enter in the code I had before it would work if I hardcoded the database name.
Now my problem is, it is reading the proper file, and tryign to save to the proper location, but it says permission denied now.
-
Jun 21st, 2005, 08:59 AM
#9
Re: Permission Denied - FileCopy
i doubt if you can copy the database you are working from with filecopy, as filecopy will not work with open files
pete
-
Jun 21st, 2005, 09:00 AM
#10
Re: Permission Denied - FileCopy
is there a command that will work with opened files?
Its weird, cause it copied it once when I had the file open (when I hardcoded the filename and path), but now it wont
verified - if I use
VB Code:
FileCopy "H:\JOB\FinancialData2.mdb", strDBLocation
it works fine
-
Jun 21st, 2005, 09:05 AM
#11
Re: Permission Denied - FileCopy
you may be able to close the access application first then do file copy, i am not sure if that would work, but otherwise use the access saveAs command, to save the database to another location
pete
-
Jun 21st, 2005, 09:07 AM
#12
Re: Permission Denied - FileCopy
Hmmm....I probably should have guessed, since this is VBA, that the file would be open.
Anyway, I don't believe you are going to be able to issue code from within a database to copy itself while it is open. The FSO in VB will copy an open file, but the code to do the copy if coming from VB, not from within the file itself.
I think the best way to solve this little problem is to write a tiny little VB app that will do the copy for you (providing the databse is closed, of course).
-
Jun 21st, 2005, 09:09 AM
#13
Re: Permission Denied - FileCopy
But could someone explain why it copies just fine if I use
VB Code:
FileCopy "H:\JOB\FinancialData2.mdb", strDBLocation
but not with
VB Code:
FileCopy Application.CurrentProject.Fullname, strDBLocation
-
Jun 21st, 2005, 09:13 AM
#14
Re: Permission Denied - FileCopy
what does Application.CurrentProject.Fullname return?
pete
-
Jun 21st, 2005, 09:14 AM
#15
Re: Permission Denied - FileCopy
boy am I embarassed
I was writing the copy file for "FinancialData2.mdb" but the file I have open is "PayrollData.mdb"
-
Jun 21st, 2005, 09:17 AM
#16
Re: [Resolved] Permission Denied - FileCopy
hmmm an open file..........
pete
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|