andrew93
12-04-2005, 02:44 AM
Hi Everyone
I had a particular piece of code that was working but I recently moved my database to another directory and this particular piece of code is no longer working.
This is the code :
'Set the new save path to a sub-directory
strPathNew = Left(CurrentDb.Name, InStrRev(CurrentDb.Name, "\", , vbTextCompare))
strPathNew = strPathNew & "Invoices\"
'Check the correct path has been returned - used for debugging purposes
MsgBox strPathNew
'If the sub-directory does not exist then create it
If Dir(strPathNew, vbDirectory) = "" Then
MkDir strPath '< THIS IS WHERE THE ERROR OCCURS
End If
Previously, if the sub-directory called 'Invoices' did not exist, then the routine would create it. Now that I have shifted the database, I'm getting an error on the MkDir line I indicated above. The error is number 76 and the description is 'path not found'. All I did was move the database from the 'My Documents' folder into a folder within 'My Documents' called 'Databases' and now this piece of code doesn't work. All of the code prior to this works perfectly. I've done a search on Google and this forum without luck and am looking for pointers.
Any thoughts as to what has gone wrong?
TIA, Andrew
I had a particular piece of code that was working but I recently moved my database to another directory and this particular piece of code is no longer working.
This is the code :
'Set the new save path to a sub-directory
strPathNew = Left(CurrentDb.Name, InStrRev(CurrentDb.Name, "\", , vbTextCompare))
strPathNew = strPathNew & "Invoices\"
'Check the correct path has been returned - used for debugging purposes
MsgBox strPathNew
'If the sub-directory does not exist then create it
If Dir(strPathNew, vbDirectory) = "" Then
MkDir strPath '< THIS IS WHERE THE ERROR OCCURS
End If
Previously, if the sub-directory called 'Invoices' did not exist, then the routine would create it. Now that I have shifted the database, I'm getting an error on the MkDir line I indicated above. The error is number 76 and the description is 'path not found'. All I did was move the database from the 'My Documents' folder into a folder within 'My Documents' called 'Databases' and now this piece of code doesn't work. All of the code prior to this works perfectly. I've done a search on Google and this forum without luck and am looking for pointers.
Any thoughts as to what has gone wrong?
TIA, Andrew