Visible Property

D

Daniel

I am trying to hide a text box until a combo box has a value of either yes
or no. A simple example of my form.

Form has a combo box with avail selections of Yes and No. I have a text box
that has the visible property set to false. I currently have code on the
combo1 after update event as follows:

If combo1 = -1 then
text1.visible - true
else text1.visible=false
end if

This works fine, except when I select Yes from the combo1 and the text box
appears, when I scroll through the records using the built in record
navigation buttons, my text box remains visible even on the records where
the combo1 value is No. How do I get the text1 to hide and unhide when
scrolling through records or on new record.

Any help would be appreciated.

Thanks,

Daniel
 
J

Jonathan Parminter

Hi Daniel,

use the form_oncurrent() event

in order to avoid duplication of code create a separate
procedure to do the test that is called by both the
combobox afterupdate() event and the form_oncurrent()
events. another thought is that you might like to have
this textbox visible - but change the enabled property.
this way users know the textbox exists and so 'look for' a
way to make it visible. for example

private sub EnableControl()
If combo1 = -1 then
text1.enabled= true
else
text1.enabled=false
end if
end sub

private sub combo1_afterupdate()
EnableControl
end sub

private sub form_oncurrent()
EnableControl
end sub

Luck
Jonathan
 

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

Similar Threads


Top