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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Activate a subform using a field

Status
Not open for further replies.

hrg

Programmer
Jan 8, 2009
46
0
0
US
Hi

I have a single form with field A. Within in this form is a subform also. What I want to be able to do is when entering ANY data into field A the sub form activates and lets me enter data in the fields in the subform. BUT If I do not enter anything into field A then I do not want the sub form to activate (and stay inaccessible), is this possible to do with or without code. Please could you help me. Obviously i want the subform then to be unaccessable when opening the form or entering new records.

Thanks
 
Subform is an object within a form just like anything else, so you can manipulate its properties whenever data is entered in 'Field A'. Specifically, you want to change the subformname.visible property. Something like this:

Sub A_LostFocus()

If [A] <> &quot;&quot;
subformname.visible = &quot;true&quot;
else
subformname.visible = &quot;false&quot;
end if

the else statement is good so if information is first entered in field a and then cleared the subform will disappear. hope this helps. -b

Brad Figler
bdfigler@magellanhealth.com
 
Hi! put this in the AfterUpdate Event of the txtbox!

if not isnull(me.A) then
[subformname].visible=true
else
[subformname].visible=false
end if


hope it works!
Skep :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top