Results 1 to 6 of 6
  1. #1
    dref is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Jan 2010
    Posts
    55

    Path change


    Hello,
    I have a database which displays this path in the start up form.
    I want to block access in case someone changes the path using vba or a macro. Help?
    Path is "C:\cage\cafe.mdb".
    The code should block when the name of that path changes either thru the form or table.
    Thanks

  2. #2
    GeekInOhio's Avatar
    GeekInOhio is offline Novice
    Windows XP Access 2007
    Join Date
    Aug 2012
    Posts
    25
    Not to state the obvious, but why not just remove the text box or label that has that info in it, or make it invisible?

  3. #3
    dref is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Jan 2010
    Posts
    55
    Just incase someone is trying to use the database on another computer,it should not open.

  4. #4
    R_Badger is offline Knows a few tricks
    Windows XP Access 2003
    Join Date
    Feb 2012
    Location
    Suffolk, UK
    Posts
    262
    Try something like this in the form open event.

    Code:
    dim filepath as string
    filepath = currentproject.path
    filepath= filepath & curentproject.name
    if filepath<>"C:\cage\cafe.mdb" then
    docmd.quit
    endif
    This prevents renaming or movement of the file, it will still open, however as soon as the form is loaded, it will check the filepath and if it is incorrect, it will then automatically exit.

  5. #5
    R_Badger is offline Knows a few tricks
    Windows XP Access 2003
    Join Date
    Feb 2012
    Location
    Suffolk, UK
    Posts
    262
    Having said that, it won't stop it being transferred assuming the filepath on the new machine is identical!

  6. #6
    R_Badger is offline Knows a few tricks
    Windows XP Access 2003
    Join Date
    Feb 2012
    Location
    Suffolk, UK
    Posts
    262
    Update:

    Try this: (again small flaw, if they think to rename their computer it wont work, however!)

    Code:
    dim filepath as string 
    filepath = currentproject.path 
    filepath= filepath & curentproject.name 
    if filepath<>"C:\cage\cafe.mdb" and environ("computername")<>"computername" then 
    docmd.quit 
    endif

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 3
    Last Post: 07-20-2012, 11:41 AM
  2. back end path
    By Mclaren in forum Programming
    Replies: 1
    Last Post: 06-08-2011, 01:13 PM
  3. Replies: 0
    Last Post: 03-01-2011, 10:47 AM
  4. Not a valid path
    By hhuuhn in forum Access
    Replies: 2
    Last Post: 08-23-2010, 02:06 PM
  5. Change Path of Make Table Query
    By Arnie49 in forum Access
    Replies: 0
    Last Post: 03-14-2010, 05:29 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