[RESOLVED] Access Right Issue - Writing a file-VBForums
Results 1 to 6 of 6

Thread: [RESOLVED] Access Right Issue - Writing a file

  1. #1

    Thread Starter
    Lively Member mips's Avatar
    Join Date
    Jan 2011
    Posts
    89

    Resolved [RESOLVED] Access Right Issue - Writing a file

    Using VB6 on Win 7 Pro.
    We gave access rights to a user for only 1 directory inside of the Z: network drive, that directory is Z:\A\
    When the user executes :

    (fn is Z:\A\test.txt, s is a string)

    Open fn For Output As 117
    Print #117, s
    Close #117

    The system does not allow him to write/open a file on that directory and it throws an exception. A different user who has access rights to the whole of the Z: network drive, is able to write a file to that directory with no problem.
    Is there something specific that needs to be set up in the VB6 program ? Or do other sub directories on the Z: drive need to allow access rights as well such as z:\temp\ perhaps ?

    Any ideas ?
    Thanks,
    Mips.

  2. #2
    PowerPoster
    Join Date
    Oct 2013
    Posts
    2,605

    Re: Access Right Issue - Writing a file

    Has nothing to do with VB, it is an access right problem.
    If the user open Notepad, writes some text and tries to save in Z:\A\ then the same error will occur.

  3. #3

    Thread Starter
    Lively Member mips's Avatar
    Join Date
    Jan 2011
    Posts
    89

    Re: Access Right Issue - Writing a file

    The user can actually write a notepad file to that directory manually. However, when it gets executed from within VB6, it throws an exception.

    Any thoughts ?
    Thanks,
    Mips

  4. #4
    PowerPoster
    Join Date
    Oct 2013
    Posts
    2,605

    Re: Access Right Issue - Writing a file

    Then give the exact error and the exact code you used

  5. #5

    Thread Starter
    Lively Member mips's Avatar
    Join Date
    Jan 2011
    Posts
    89

    Re: Access Right Issue - Writing a file

    OK, I found out what was the issue.
    So when fn = "Z:\A\test.txt" , that did not work.
    But when fn = "\\MYSRV\Zdrive\A\test.txt" , that works. Using Z: as a mapped drive name, did not work in this case.

    Thanks,
    Mips. :-)

  6. #6
    PowerPoster
    Join Date
    Feb 2006
    Posts
    16,570

    Re: [RESOLVED] Access Right Issue - Writing a file

    There is probably something else going on.

    For example a lot of people let users run wild using Administrators accounts. Because of the split contexts such users have, a drive mapping might exist in one context and either not exist at all or have a different mapping in the other context.

    Very few users should have an Administrators account. Developers often need them, but developers should be well aware of how the dual user-context mechanism works. We've had to deal with this since it came out back in 2006.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.