Locking certain records in a table

A

Annetta

Is there a way to lock certain records within a table? For example, if I
wanted to lock records entered prior to September 19, 2008, is there a way to
do that? Also, is there a way to force users out of a database? If I need
to make design changes and someone is idly in the database, can I force that
user out?
 
T

tedmi

The answer to your locking question depends on what you mean by "lock".
Prevent these records from being displayed? Or show them but prevent changes
to them?
 
A

Annetta

Yes, I'd like them to be displayed but prevent changes from being made to
them. Is there a way to do this?
 
J

Jerry Whittle

Access does not support record-level locking at least in the way that you
mean. Some other databases do. You might be able to do so by implementing
user-level security and some complex queries or forms. Often the best way
around this problem is to train then trust your users. Also back up nightly!

If the database is split, you should be able to make changes to the front
end (FE) in a development environment (complete with its own back end (BE) of
test table data) then give the users the new copy of the FE. Making changes
to the production BE can be a little more difficult. I often do such work on
evenings and weekends when the users aren't around.
 
A

Armen Stein

Access does not support record-level locking at least in the way that you
mean. Some other databases do. You might be able to do so by implementing
user-level security and some complex queries or forms. Often the best way
around this problem is to train then trust your users. Also back up nightly!

As Jerry says, Access doesn't support this at the database level. It
would be tricky with any database, actually.

But if your users are just using Access forms, and you trust them not
to try to get to the database directly, you can use a ClosedFlag field
or a LockAsOfDate field to programmatically determine whether a record
should be editable when it is shown on in a form. If it isn't, you
can loop through all the controls in the form's control collection and
set them to Locked=True. You can also set the background color of the
controls to a non-editable color like the Windows background color
(e.g. gray).

This assumes that you are using a form in single view - this won't
work with multiple records on a continuous form.

Armen Stein
Microsoft Access MVP
www.JStreetTech.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top