View Full Version : Relation between combo and checkbox


expublish
03-18-2002, 06:07 AM
I have a check box on a form that asks the user if a test has been done. Tick for yes don't for no. Easy.

Next to this I have a combo where the user selects what the result of the test was (Pass, Fail, Waiting for Results).
I would like to make it so that if the user selects a value from the combo, the check box automatically gets ticked. This will eliminate any chance of them selecting a result without indicating they have taken the test (which is relevant to some reports).

Also, is it possible to lock a field until another field has been checked (ie, lock the combo until the checkbox has been ticked - which will do the same as above).

Thanks in advance

Scott.

Geoff Codd
03-18-2002, 06:41 AM
there is several ways to do this but the way i like is to set the combo box to invisible on form load and to visible on check box tick the code you want is

on form load enter

if me!checkboxname = 0 then
me!comboboxname.visible = false
else
me!comboboxname.visible = true
endif

then for the tick box enter the following code for the after update event

if me!checkboxname = 0 then
me!comboboxname = null
me!comboboxname.visible = false
else
me!comboboxname.visible = true
endif

you can also replace visible with enabled and locked to create the same sort of effect

expublish
03-18-2002, 08:19 AM
Many Thanks Geoff, your first method works perfectly.

Regards

Scott