Disabling Specific Records

T

thefonz37

If I have a form based off a table and I want to allow users to edit some of
those records, but I don't want them to be able to edit other records (I'm
displaying them in continuous forms mode), how can I "lock" those records in
the table? Is this even possible?

I have this code:
If [timestamp] < #6/8/2009# Then
txtStartTime.Enabled = False
txtEndTime.Enabled = False
cboExceptionType.Enabled = False
End If

Whenever it hits one record that returns a true on the if condition, it
disables all instances of the controls.
 
M

Marshall Barton

thefonz37 said:
If I have a form based off a table and I want to allow users to edit some of
those records, but I don't want them to be able to edit other records (I'm
displaying them in continuous forms mode), how can I "lock" those records in
the table? Is this even possible?

I have this code:
If [timestamp] < #6/8/2009# Then
txtStartTime.Enabled = False
txtEndTime.Enabled = False
cboExceptionType.Enabled = False
End If

Whenever it hits one record that returns a true on the if condition, it
disables all instances of the controls.


You can not lock some records in a table.

In a continuous form, any control property you set using
code will be applied to all instances of the control because
there is only one control. The controls are just being
displayed multiple times. This is only an appearance
problem because the current record is the only one that
needs to be enabled/disabled.

If you want the appearance of the other records to reflect
their own timestamp for enabled/disabled, then you should
use Conditional Formatting (Format menu). Set the
Expression Is option to:
[timestamp] < #6/8/2009#
and set the disabled CF property. Repeat for the other two
controls.
 
B

Bob Quintal

If I have a form based off a table and I want to allow users to
edit some of those records, but I don't want them to be able to
edit other records (I'm displaying them in continuous forms mode),
how can I "lock" those records in the table? Is this even
possible?

I have this code:
If [timestamp] < #6/8/2009# Then
txtStartTime.Enabled = False
txtEndTime.Enabled = False
cboExceptionType.Enabled = False
End If

Whenever it hits one record that returns a true on the if
condition, it disables all instances of the controls.

You need to set the .enabled properties True when the timestamp
criteria is not met.

If [timestamp] < #6/8/2009# Then
txtStartTime.Enabled = False
txtEndTime.Enabled = False
cboExceptionType.Enabled = False
Else
txtStartTime.Enabled = True
txtEndTime.Enabled = True
cboExceptionType.Enabled = True
End If

Note that this will cause all the rows to flicker as you scroll
through enabled and disabled records.
you could use the .locked property instead of or in addition to the
enabled property
txtStartTime.Enabled = False
txtStartTime.Locked = True
 

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