Link to home
Start Free TrialLog in
Avatar of bfuchs
bfuchsFlag for United States of America

asked on

I suddenly cannot write to C drive

Hi Experts,

I had the following code in my app running fine for years, and suddenly this stopped to work, for me and for other users as well, and there is no error msg.
    DoCmd.OutputTo acOutputServerView, "dbo.view_MyFile", A_FORMATXLS, "C:\MyFile.csv"

Open in new window

However I realized that if changed for sub-folders like this it works
    DoCmd.OutputTo acOutputServerView, "dbo.view_MyFile", A_FORMATXLS, "C:\Application\MyFile.csv"

Open in new window

Wondering what caused this?

Is this perhaps due to latest windows updates?
Avatar of John
John
Flag of Canada image

C:\MyFile.csv is a file in the root of C:

C:\Application\MyFile.csv is a file in a folder which resides in root of C:

I do this and do not know of any updates that prevent this.

I will continue looking for some reasons.
SOLUTION
Avatar of dnojcd
dnojcd
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
This is by design, and you should really really not try to circumvent it. It's a great protection against hurting your boot drive.

So - as you have found out - create a subfolder for the purpose, or use the user's Documents or LocalAppData folder (can be located with %Documents% and %LocalAppData% respectively).

/gustav
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
There is a limit to the number of "files" you can have in your root directory and apparently you have reached it.  The actual limit is controlled by your OS and whether you are using FAT or NTFS or some other file system.  The maximum number of files in a folder is handled differently and I think that is controlled by the maximum file size allowed since the file list of each folder is actually stored in a file.
Avatar of bfuchs

ASKER

Hi Experts,
@gustav,
can be located with %Documents% and %LocalAppData% respectively).
How do I program this in my code?

I suspect that it's a domain wide change, put in place by your administrator.
I believe thats the case as I'm getting the attached when doing it manually.

BTW, if admin credentials is good enough, why should it be necessary to click continue when user is logged in as admin (and what kind of protection is this anyway..)?

Another question, why am I not getting any errors from within Access?

There is a limit to the number of "files" you can have in your root directory and apparently you have reached it.
Dont think that the case here as I'm able to do it manually, see attached.

Thanks,
Ben
untitled.png
Win 7 security is more robust than earlier versions of Windows.

If you run the task in administrator mode (not just logged as an administrator) do you get the same error?
Avatar of bfuchs

ASKER

If you run the task in administrator mode
Tried right clicking on my Access app icon but dont see option run as admin, how can I test this?

Thanks,
Ben
How many files do you have in the root folder?

Did you look up the limits for your OS and file system?
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
> How many files do you have in the root folder?

Pat, your are showing your age. That could be an issue in the days of DOS and Windows 3.11.
These days no one stores thousands of files in the system root folder.

/gustav
This person is.  

bfuchs can't write a file directly to the root folder but he can write it to a sub folder.   Since I remember DOS (not all that fondly), I remember that there are limitations on the root folder that don't apply to other folders.  And yes, those of us who worked with DOS got the memo but not all current users have any knowledge of DOS which underlies Windows to this day.  I'm sure you've seen vestiges of former limitations.  They exist everywhere.  I ran into one recently where I ended up renaming a file (named by a user- not me) to remove spaces and special characters to get the app to accept the file as input.
True, those were the days. But this is NTFS where a normal user meets no limits.

But access rights prohibits a normal user account to write files directly to the root of the system drive. Another reason for never using an admin account for everyday's use.

/gustav
I hate to argue about this but how hard is it to determine the number of files in the root directory?  Why discount the possibility out of hand without even knowing if bfuchs is using FAT32 which does have limits?  Open Windows explorer to the C: drive.  Look at the bottom left, the form tells you the file count.  Do the same thing on another computer with the same problem.  Are the file counts the same?  If not, then this isn't the problem and it is most likely a change to security permissions.  I don't put lose files in the root directory but it appears that others do.
Windows 7 won't run on FAT32.
An NTFS volume can hold 4,294,967,295 (2^32 minus 1) files/folders, not excluding the root folder.

/gustav
Avatar of bfuchs

ASKER

@Pat,

See attached.

Also as stated above, if the limit was reached then why can I copy files manually?

Thanks,
Ben
untitled.png
You said you could copy files to subfolders but not to the root folder.  Apparently that was not an accurate description of the problem since you have just changed the problem statement.  You also never said that you were deleting the files from the root folder.  It sounded like you were simply appending files and forgetting them.

If there are not huge numbers of files in the root folder, then you are not running into some root folder file limit.  That leaves some security change so talk to your network administrator.
As said, even if you could, refrain from saving user files in the root of the system drive. If you run - as you should - with a normal user account, you are not granted rights to save anything in this folder. It is a security precaution, and these you shouldn't play with.

As far a I know, saving files with normal user privileges has been blogged since Windows Vista, so I can't tell how you have gotten away with it earlier.
Anyway, to play nice, the place for saving files for the user to locate later should always be in the user's folders for the purpose (documents, pictures, etc.) or (of course) a subfolder thereof.

/gustav
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of bfuchs

ASKER

Our admin doesn't recall applying any security changes recently, however I think its time to close..

Thanks to all participants!