Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hiding Values

Status
Not open for further replies.

Cillies

Technical User
Feb 7, 2003
112
GB
Hi, I have a form catering for research material, this form is also filled with Yes/No boxes that relate to the material.

The user selects the yes/no boxes that apply to each individual record, which could be 6 out of forty. This is fine but when I come to displaying the report I don't want to be displaying all other yes/no boxes that don't apply to that record.

Is there any way that I can hide the yes/no boxes that are false and only display the ones that are true. This would also apply to the labels of each box.

Hope someone can help

Kindest regards
Cillies
 
Hi!

One method, is to use the a loop, I'm assuming this is in the detail section? Use the on format event, perhaps something like this:

[tt]dim ctl as control
for each ctl in me.controls
if ctl.controltype=accheckbox then
ctl.visible=ctl.value
end if
next ctl[/tt]

- if the value is true, then it's visible. The labels, as long as they are attached, will inherit the setting.

Roy-Vidar
 
Thanks Roy for the speedy reply, unfortunatly I won't be able to get to try it out until later tonight.

I was just wondering about the display of the yes/no controls, as I mentioned earlier, there are quite a few. will I have to lay them all out beside each other, or (which I don't think there is)does access have the capability of only displaying the yes/no boxes that are true in a certain section f the report.

Kindest regards
Lee
 
Hi again!

I'm not that much of a "report tweaker", but my previous method involves only toggling the visible property of all controls based on the value (but doing so "wholesale", without the need to address the controls individually).

It is possible to alter the location of controls, for instance based on a value. It's surely also possible to do it dynamicly. This is not something I've tried, but here's some thoughts...

You'd be using the controls .Top and .Left property. Remember you can only move them within the dimensions of the section in which they reside (you'd need to calculate the height of the controls so that the height of the detail section equals or is greater than the controls .Top property plus the .Height property). The measurement is performed in Twips, where 1 inch is 1440 twips, 1 cm is 567 twips.

Here's a little snippet changing location of a checkbox control based on the value:

[tt]if Me!chk1.Value then
me!chk.visible=true
me!chk1.top = 54
me!chk1.left = 340
else
me!chk.visible=true
me!chk1.top = 54
me!chk1.left = 7500
end if[/tt]

I think for starters, you'd need to address each individual control, "remember" how many controls are being displayed, use for instance some array (table?) for the locations, or calculate some other way (here the control chk and a number (if N= 6 then "chk6") ("controls array") and adding a certain amount of twips based on the number of controls alredy being displayed):

[tt]Me("chk" & N).Left = NumVis * 1000 [/tt]

Note alse, using this, you'd have to address the labels individually too, they won't (I think) inherit the changed location

Roy-Vidar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top