Get backend path for FileCopy

Rachael

Registered User.
Local time
Today, 23:47
Joined
Nov 2, 2000
Messages
205
Hi,

I have posted thisissue a few times over the past week but will little success, so sorry to be repetitious.

The problem;

I've got these lines in a A2000 db that I use to get the backend path so that a copy of the backend can be made each time the user logs on. The event is in the on-open of my splash.

Dim strConnect As String
strConnect = Mid(DBEngine(0)(0).TableDefs("Blocks").Connect, Len(";DATABASE=") + 1)

FileCopy strConnect, "C:\My Documents\VADataFile_BackUp.mdb"

This code works fine in A2000 and A2000 runtime but is not liked by my clients who have AccessXP. It throws up an On Open expression error message. If I remove the lines the db works fine in AXP.

I am thinking that the strConnect bit could be re-written to work in AXP, as I don't have a copy of AXP was wondering if someone could quickly test it for me. I hope I'm not asking to much but do desperatley need to solve this as not all my clients install their dbs to the default location (and one should never assume that they do anyway).

Thankyou for any help, info and replies.

Regards,

Rachael
 
Sorry, I should have posted this in modules vba, please forgive me....
 
?? Well here it is.... I am running W2k office XP

?mid(currentdb().TableDefs("test").Connect,len(";DATABASE=")+1)
F:\Test\Test.mdb

Seems to be fine...

Filecopy "F:\Test\Test.mdb", "F:\TestCopy.mdb"

Seems fine too...

No problems here..... Your sure about my documents beeing there??

I cannot think of anything else at this moment

Regards
 
Thanks Namliam for your response and testing,

That has narrowed down the problem, does the My Documents folder exist with Windows XP? Perhaps thats my problem, becuase the other day I had a client running Office 2000 have the problem occur, perhaps they are running Windows XP.

Could I possibly trouble you some more, does the C:\My Documents path exist in XP?

Thankyou again,

Rachael
 
I think thats different on every machine, you will have to check localy...
You can allways make sure...

chdrive("C")
chdïr("C:\")
on error resume next
mkdir "My Documents"
on error goto 0

Will create the directory if it doesnt exist... It is airware tho (untested and out off memory)

Regards
 
Geez Thanks Namliam for the quick response, over here in Australia I'm used to posting one day and getting a response the next.

thankyou also for the clues, I was assuming that C:\My Documents was a standard thing on all computers and would never pose a problem.

Cheers, Rachael
 
One thing i have learned is: NEVER ASSUME ANYTHING

and: EXPECT THE UNEXPECTED

Regards
 
Windows XP computers do not have a generic "My Documents" folder on the C:\ drive. Each users login determines where their "My Documents" folder is and they are all under the path C:\Documents and Settings\UsersLogin\My Documents\

But...

All XP computers have an \All Users\ @ C:\Documents and Settings\All Users\ folder.

If your users have different versions of Windows then you should consider using a custom folder off of the C:\ drive like C:\MyFiles\

HTH
 
Thanks ghudson,

I've learn't a lesson thats for sure, thanks for the info on Windows XP. What I have decided to do is create an area for the user to enter in the path of where they want to have a copy of there backends made to and store this with there data. I have incorporated a tick box to enable/disable the copying action so that when enabled a copy is automatically made at startup. My clients who have certain parts of there hard drives (ie My Docs) backed up as a regular routine can select the destination, alterantively they could select a network drive that is routinely backed up.

Problem solved!

Rachael
 
I suggest that you allow the users to "browse" where they want the files placed. Allowing the users to type in their locations can cause problems unless you are verifying that the location the "type" exists. Check out this link on how to call the Windows folder browser function...

API: BrowseFolder Dialog

HTH
 

Users who are viewing this thread

Back
Top Bottom