Code to makes subform fields appear depending on tick box value

ladyfame

Registered User.
Local time
Yesterday, 17:55
Joined
Mar 3, 2009
Messages
15
I have a form, which has a sub-form.
One of the columms has a tick box
when I tick this tick box I want 3 of the columns to appear
when its unchecked I don't want them to appear

what code do i use, its confusing.
I can do it on a non-subform cos i can make it "visable - no" then write a code to make it visable when i tick a tickbox but on a subform its confusing.

this is what everything is called.
form - APPOINTMENT
subform - TREATMENT subform
tick box - Dye required
the fields i want to appear / not -
Dye (combo)
Dye Price (link to due combo)
Dye colour (combo)
 
See if Conditional Formatting does what you want. Format/Conditional Formatting, or on the ribbon in 2007. Visible isn't one of the options, but a little creativity with font and background colors achieves the same result.
 
the fully specified reference is something like
Forms![Orders]![Orders Subform].Form.controls("controlname").visible = false

In the parent form, (Orders in this example) maybe you can shorten it with just
[Orders Subform].Form.controls("controlname").visible = false


where [orders subform] is the NAME of the subform CONTROL on the ORDERS form.
 
I'm really confussed. I'm doing the code in the "code builder" bit?...
Can some one please give me example of the coding? :(

I'm not trying to do anything to the main form, Just the Sub-Form on it. :/

:confused:
 
dont use the code builder

if you are IN the subform, then in the current event you can say

if sometest = true then
somefield.visible = true
else
somefield.visible = false
end if

(for conciseness this can be rewritten just as follows - but the meaning is lessobvious)

somefield.visible = sometest

----------
however, if the form is a continuous form - then you cant hide the column in some rows, and display it in others - its all or nothing
 
dont use the code builder

if you are IN the subform, then in the current event you can say

if sometest = true then
somefield.visible = true
else
somefield.visible = false
end if

(for conciseness this can be rewritten just as follows - but the meaning is lessobvious)

somefield.visible = sometest

----------
however, if the form is a continuous form - then you cant hide the column in some rows, and display it in others - its all or nothing

Can't I use that code IN the code builder? I Kinda have to do it in the code builder.....
 
You understand that using that method on a continuous subform, the format of the selected record will apply to all displayed records, regardless of the status of the checkbox on each record?
 

Users who are viewing this thread

Back
Top Bottom