Can CheckBox be disable in Continuous Forms

T

ThomasAJ

In a 'Continuous Forms' form is there any way a check box can be disabled on
a 'per record' basis.

ie conditionally disabled (programatically) for 1 record but not affecting
other records.
 
A

Allen Browne

No. Controls cannot be disabled in some rows only of a continuous form.

You may be able to simulate it visually with a text box containing a
Wingdings checkmark character, and use conditional formatting to gray it on
some rows. By placing it in front if the real text box, you can use the
Enter event of this text box to SetFocus to something else
(Screen.PreviousControl perhaps) if it's supposedly 'disabled', or to the
real check box that was behind the text box.
 
A

Anthony

Allen, I am having the same issue and want to make sure I understand your
answer. I have a continuous form that can display 2 complete records at a
time from a 1200 record database. Each record has about 30 fields. A record
can be either archived or not archived, depending on how a check box is set
on that record. I would like to prevent changes to a record (disable the
fields) on records that have the "archive" box checked, while allowing
changes on records that do not have the box checked. Since the continuous
form can display 2 records at a time, the first record may be archived and
the next displayed record may not be. Can the fields be disabled (or
otherwise prevent changes) to the archived record on the continuous form
while allowing changes on the non-archived record. Obviously, the checkbox
itself would ALWAYS have to remain active so you can change a record from
archived to non-archived.

Would coding something in an "OnEnter" event work? Maybe when you enter
that control, it checks to see if the archive box is checked? If so, it
"locks" that field.


Allen Browne said:
No. Controls cannot be disabled in some rows only of a continuous form.

You may be able to simulate it visually with a text box containing a
Wingdings checkmark character, and use conditional formatting to gray it on
some rows. By placing it in front if the real text box, you can use the
Enter event of this text box to SetFocus to something else
(Screen.PreviousControl perhaps) if it's supposedly 'disabled', or to the
real check box that was behind the text box.
 
A

Allen Browne

Use the Current event procedure of the form to lock/unlock the controls
(other than the archiving check box), depending on the value of the yes/no
field. Run the same code in the AfterUpdate of the check box, to respond to
any changes just made.

You can either hard-code the names of the controls to be locked/unlocked. Or
you may be able to adapt the code from this example that loops through the
bound controls and locks/unlocks them:
Locking bound controls on a form and subforms
at:
http://allenbrowne.com/ser-56.html
 
A

Anthony

Thank You for your quick response all the way from down-under. I used your
advice (using the Current event procedure) but I am not sure it is working.
I have a conundrum. When the archive flag is set, it would be very
efficient to just use "Me.Allowedits = False" to lock the whole form.
However, I have an unbound filter field in the form that I do not want to
lock. I tried using "Me.<unbound field>.Locked = False" but apparently that
will not override a "Me. Allowedits = False" command. Sooo, I have had to
hard-code EACH field name using the "Me.<fieldname>.locked = True" command,
which works great.
However, when I come across a record that is not archived, I thought I
could just say "Me.Allowedits = True" and be done with it. However,
apparently "Allowedits = True" does NOT override the individual field locks
I previously set on the archived record.
Do I need to unlock the fields individually by hard-coding each field name
again with the "Me.<fieldname>.Locked = False"? Or is there a more
programmatically efficient way of unlocking those fields? I looked at your
unlock/lock code, but since I am not a sophisticated programmer, your code
was too confusing with "Case" routines and "Select" commands with several
levels of "IF" statements. I didn't know where to start to customize your
code to my needs. If I studied your code I could probably figure it out, but
my head started hurting after a few minutes.
 
D

Douglas J. Steele

If you've locked individual controls then yes, you'll need to unlock the
individual controls.
 

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