See post # 6
See post # 6
Last edited by kfcSmitty; Jun 21st, 2005 at 09:17 AM.
Try this:Code:MsgBox (Application.Path)
Blessings in abundance,
All the Best,
& ENJOY!
Art . . . . Carlisle, PA . . USA
Application does not support .Path![]()
It does in Excel. What application are you using?
Blessings in abundance,
All the Best,
& ENJOY!
Art . . . . Carlisle, PA . . USA
Oh yeah, sorry. I'm using Access 2002
I have it working with
VB Code:
FileCopy Application.CurrentProject.FullName, strDBLocation
but it keeps saying permission denied now :/
First, you need a backslash before the source location.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 likeVB Code:
FileCopy app.Path & "\FinancialData.mdb", strDBLocationDoes strDBLocation contain the new folder path AND the db name?VB Code:
FileCopy "c:\folder\FinancialData.mdb", "c:\otherfolder\FinancialData.mdb"
Please use [Code]your code goes in here[/Code] tags when posting code.
When you have received an answer to your question, please mark it as resolved using the Thread Tools menu.
Before posting your question, did you look here?
Got a question on Linux? Visit our Linux sister site.
I dont answer coding questions via PM or EMail. Please post a thread in the appropriate forum section.
Creating A Wizard In VB.NET
Paging A Recordset
What is wrong with using On Error Resume Next
Good Article: Language Enhancements In Visual Basic 2010
Upgrading VB6 Code To VB.NET
Microsoft MVP 2005/2006/2007/2008/2009/2010/2011/2012/Defrocked
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.
i doubt if you can copy the database you are working from with filecopy, as filecopy will not work with open files
pete
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
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
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).
Please use [Code]your code goes in here[/Code] tags when posting code.
When you have received an answer to your question, please mark it as resolved using the Thread Tools menu.
Before posting your question, did you look here?
Got a question on Linux? Visit our Linux sister site.
I dont answer coding questions via PM or EMail. Please post a thread in the appropriate forum section.
Creating A Wizard In VB.NET
Paging A Recordset
What is wrong with using On Error Resume Next
Good Article: Language Enhancements In Visual Basic 2010
Upgrading VB6 Code To VB.NET
Microsoft MVP 2005/2006/2007/2008/2009/2010/2011/2012/Defrocked
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
what does Application.CurrentProject.Fullname return?
pete
boy am I embarassed![]()
I was writing the copy file for "FinancialData2.mdb" but the file I have open is "PayrollData.mdb"
hmmm an open file..........
pete