Page 1 of 2 12 LastLast
Results 1 to 15 of 20
  1. #1
    aspen is offline Competent Performer
    Windows Vista Access 2010 64bit
    Join Date
    Jun 2011
    Posts
    127

    Using >bat file causing Errors in Access codes

    Code:
    cls
    @ECHO OFF
    title Folder Locker
    if EXIST "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" goto UNLOCK
    if NOT EXIST Locker goto MDLOCKER
    :CONFIRM
    echo Are you sure u want to Lock the folder(Y/N)
    set/p "cho=>"
    if %cho%==Y goto LOCK
    if %cho%==y goto LOCK
    if %cho%==n goto END
    if %cho%==N goto END
    echo Invalid choice.
    goto CONFIRM
    :LOCK
    ren Locker "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
    attrib +h +s "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
    echo Folder locked
    goto End
    :UNLOCK
    echo Enter password to Unlock folder
    set/p "pass=>"
    if NOT %pass%==type your password here goto FAIL
    attrib -h -s "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
    ren "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" Locker
    echo Folder Unlocked successfully
    goto End
    :FAIL
    echo Invalid password
    goto end
    :MDLOCKER
    md Locker
    echo Locker created successfully
    goto End
    :End
    Hi Every body
    I am using the above code to lock and unlock the folder where my data base is in. I have some related folders in the same folder that's automatically created on load. I have code behind a button to open the current project path to view these folders. Since I started using the Database in a bat, file created folder I get errors on clicking the current project path open button. Instead of showing the folders Its opening the internet explorer and bing search page. Can some one advise what should I do.

    here is the code to open project path
    Code:
    FollowHyperlink CurrentProject.Path


  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    The FollowHyperlink command works for me when tested in the VBA immediate window. What happens when you test it there when you are sure the folder is unlocked?

    Does 'locked' mean write protected?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    aspen is offline Competent Performer
    Windows Vista Access 2010 64bit
    Join Date
    Jun 2011
    Posts
    127
    No Its Just password protected. When I delete the .bat file and press the button it opens normally the folder path. But if I paste back the file then it opens the bing search web page

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    How/when is the bat file executed? What would I need to change in the script to run? Where should the bat file reside?

    I've never tried this and will need some guidance to set up so I can test and try to replicate issue.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    aspen is offline Competent Performer
    Windows Vista Access 2010 64bit
    Join Date
    Jun 2011
    Posts
    127
    Thanks. Just change the password line and write a password
    if NOT %pass%==Test here goto FAIL
    And copy it to noepad and save it some folder. when you click it it will create a folder. click again and it wil ask if you want to close. type "y" and pres enter. Now the folder is hidden. Click again and it will ask for password. type "test and press enter. or see this

    http://social.microsoft.com/Forums/e...t-any-software
    Glad you are trying to help

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    I saved Locker.bat with the password edit in same folder as the database. Running the bat went as you describe. The folder is created, locked, hidden.

    FollowHyperlink CurrentProject.Path still opens Windows Explorer.

    Ran the bat again to unlock folder and it is now visible.

    FollowHyperlink CurrentProject.Path still opens Windows Explorer.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  7. #7
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    You might try changing
    attrib -h -s
    to
    attrib -h

    It is probably the folder attributes that are causing the confusion on whether to use Explorer vs. the default Web Browser to open the folder. Another approach might be to use a shell command to open the folder. Either way, does not seem to be the most practical approach to locking a folder.

  8. #8
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    @ June

    So Hyperlink method works fine on system and hidden folders? You did not experience the same symptoms as OP?

  9. #9
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Ooops, did not set this up properly.

    How does the database get saved into new folder created by the bat? Guess I need to create the folder and manually copy database into it. Then run the bat to lock/unlock. Now I get Internet Explorer with FollowHyperlink from this copy of database. FollowHyperlink from the database copy not within the Locker folder opens Windows Explorer.

    Confirmed the issue is not system specific. Something about the bat changes the folder and FollowHyperlink acts different. Removing -s switch from the bat command made no difference. Sorry, no idea how to fix.

    Folder won't lock if database is open, which makes sense, doesn't error but doesn't lock either.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  10. #10
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    I was just throwing suggestions out there. I did not test it myself. I was curious if FollowHyperlink worked on system and or hidden folders. I am thinking it will not.

  11. #11
    aspen is offline Competent Performer
    Windows Vista Access 2010 64bit
    Join Date
    Jun 2011
    Posts
    127
    Quote Originally Posted by ItsMe View Post
    I was just throwing suggestions out there. I did not test it myself. I was curious if FollowHyperlink worked on system and or hidden folders. I am thinking it will not.
    Thanks June7 and Its me. Probably As Its me pointed out it not the best way to lock a folder. I would Apreciate if you could Tell me a better method to Enable locking the project current path. I want to keep the data base and the folders associated with that are in the current project path locked by passwoed or some way. So any body else with the user account password cannot unlock it. Thanks

  12. #12
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    I have no idea.

    I manage a split design database. I keep a master copy of frontend that I use for design editing in a protected folder only I have permission to. Then a published copy is placed in another folder that has no restrictions. The backend folder of course has to be unprotected so any user can write data.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  13. #13
    aspen is offline Competent Performer
    Windows Vista Access 2010 64bit
    Join Date
    Jun 2011
    Posts
    127
    So how Do you protect It. I am the administrator of the pc. The files are in my user account as a user. Its windows 8.1. I am not very familiar with. But then Can't It be easily hacked? Can you give me a link or something. Thanks

  14. #14
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Protect what - the frontend? With split design, each user has a copy of the frontend on their computer. I could use password protection on the backend but that is just not necessary in our environment. Anyone authorized to login to our local network and also has the frontend on their computer is an authorized user for data entry/edit through the frontend. The frontend is designed so users don't see the navigation pane and ribbon is customized. So unless they know about the shift key bypass and/or where the backend is located, risks are minimized. Most of my users are not that Access aware and none have malicious intent.

    I don't know any resources on what you are trying, never seen anything like it.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  15. #15
    aspen is offline Competent Performer
    Windows Vista Access 2010 64bit
    Join Date
    Jun 2011
    Posts
    127
    Quote Originally Posted by June7 View Post
    Protect what - the frontend? With split design, each user has a copy of the frontend on their computer. I could use password protection on the backend but that is just not necessary in our environment. Anyone authorized to login to our local network and also has the frontend on their computer is an authorized user for data entry/edit through the frontend. The frontend is designed so users don't see the navigation pane and ribbon is customized. So unless they know about the shift key bypass and/or where the backend is located, risks are minimized. Most of my users are not that Access aware and none have malicious intent.

    I don't know any resources on what you are trying, never seen anything like it.
    Thanks june7. Actually My question apply more to windows than access. I Am trying to find a way to completely Lock and hide Some Files. May be something like this. I am not sure this could be vba possible.

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 7
    Last Post: 03-27-2014, 11:47 AM
  2. Access Codes
    By Probie in forum Code Repository
    Replies: 3
    Last Post: 06-04-2013, 01:18 PM
  3. Intercepting error codes like 2220, file not found
    By justphilip2003 in forum Programming
    Replies: 4
    Last Post: 04-21-2013, 11:33 AM
  4. Errors with Access file for multiple users
    By Monterey_Manzer in forum Access
    Replies: 3
    Last Post: 06-20-2012, 03:44 PM
  5. Blank column causing errors on import
    By brickballer in forum Import/Export Data
    Replies: 7
    Last Post: 05-20-2011, 12:54 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums