continuous - want to change properties of object based on another object data

L

lchewer

Having trouble with this one continuous form......i've tried many
alternatives on the load and open event without luck.
The fields/record are Category , Subcategory , Item , Checkbox

When the Subcategory is blank, i want the checkbox to not be visible for
that record (line of data on the form).

Obviously something like IF me.subcategory = " " then
me.checkbox.visible = false
does not work. Conditional formatting cannot be applied to checkbox either.

Among other attemps, i also tried using Dlookup to determine when
Subcategory would be blank, then using essentially "If varSubCatCount isNull"
set checkboxnot visible....no good.

The problem i now realise is even though i see many records, the
'system' sees only one leading me to believe i'll need to walk through
using a recordset or loop somehow......or even trick it by adding a dummy
field ie cover the checkbox so it can't be seen if the subcategory is blank.

All help is greatly appreciated.......i spent 4 hours today searching
for a solution on the internet to no avail.
 
A

Allen Browne

You cannot conditionally hide controls in a continuous form.

It may be possible to simulate the effect by placing a text box on top of
your check box. Set the Control Source of the text box to something like
this:
=IIf([subcategory] Is Null, Null, [MyYesNoField])
The text box will then have 3 possible values:
Null, which leaves it blank (simulating a hidden check box)
0 for False (unchecked box)
-1 for True (checked box.)

Now set the Font for the check box to WingDings, and set the Format property
so it shows the checked box character for a negative value (true), and the
unchecked box for zero (false), and nothing for null. More info:
Format Check boxes on reports
at:
http://allenbrowne.com/ser-52.html

Now the remaining issue is that you have a non-operational simulated check
box rather than a real one you can click to change. To solve this, place the
real check box behind the text box. Use the Enter event of the text box to
SetFocus to the check box if the text box is not null. The interesting thing
is that it jumps forward only on the current row, so the other rows of the
continuous form still look correct.
 
A

AccessVandal via AccessMonster.com

This code must be on the Current Event of your form.
Obviously something like IF me.subcategory = " " then
me.checkbox.visible = false
does not work. Conditional formatting cannot be applied to checkbox either.

The code checks for a blank condition, however it does not check for Null
condition.

Use...

If IsNull(me.subcategory) or me.subcategory = "" then
me.checkbox.visible = false
else
me.checkbox.visible = true
end if

Older version of access hides the control on a continuous form if it is
"true". It works on a single form but not so on a continuous form as it will
hide all the rows for the checkboxes.
 

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