1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

VBA Table level validation - set to read only

Discussion in 'Business Applications' started by anamque, Jan 19, 2011.

Thread Status:
Not open for further replies.
Advertisement
  1. anamque

    anamque Thread Starter

    Joined:
    May 25, 2010
    Messages:
    29
    Hello, I have a 2007 Access database, where one of my tables has to be set to read only. The table acts as a "log table" - it captures the person's name, time in & time out (all of these fields work fine).

    However, I do have to set the log table as read only or to not allow edits (whichever would be easier). We want to avoid someone going in and deleting a row of records. But still want to allow the table to continue to add rows with the user name and time as they continue to use the database.

    I would much rather use a VBA code to add a table level validation b/c of the "sensitivity" of the data.

    I've tried using this piece of code:


    CurrentDb.TableDefs("Table1").ValidationRule = False

    but have not had any luck yet....
     
  2. anamque

    anamque Thread Starter

    Joined:
    May 25, 2010
    Messages:
    29
    Since this expression is always false, Access won't allow any entries or alterations (so the table no longer creates/updates the log) .

    I’m thinking I need something to prevent deletions on a table level in VBA.
     
  3. OBP

    OBP

    Joined:
    Mar 8, 2005
    Messages:
    19,895
    Why prevent deletion in the table?
    Why not hide the Tables and set the form to "No Deletions"?
     
  4. anamque

    anamque Thread Starter

    Joined:
    May 25, 2010
    Messages:
    29
    Due to security reasons - so the Log table is capturing users who enter in and out of the database, we need to prevent edits & deletions in order to ensure someone won't enter into the database, intentionally destroy or edit a record to their favor, and try to cover up the their tracks by editing the Log Table.

    There is not a form where they interact with the data. The only form I have is acting as a switchboard, which will have shortcuts to the reports but never to the tables/queries/data...

    Since I originally posted this question, I've received more information on my project......

    To make a long story short, they are asking to implement a vba code where we identify users a, b, c are in a "admin" group, who have the ability to read, write, delete to all or some tables. I also have to identify users d, e, f who are in a "users" group, who have the ability to read only to some tables. I understand you can set users and permissions via Access - but for security reasons, I'm not allowed to utilize this feature.
     
  5. OBP

    OBP

    Joined:
    Mar 8, 2005
    Messages:
    19,895
    Sorry this "you can set users and permissions via Access - but for security reasons, I'm not allowed to utilize this feature." does not make sense. Access User Level Security is far more Secure than VBA.
     
  6. Sponsor

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/975665

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice