SubForm disable one column to add

G

Guest

I have mainform and one subform.
In mainform checkbox zRent, If zRent is true then we can Enable a field in
subform SubRent. Means when the zRent is true then we can get the data in
subform subRent otherwise this SubRent field should be disabled.
 
S

strive4peace

enable/disable control in subform based on control in mainform
---

Hi Mohammed,

put this code behind your mainform:

'~~~~~~~~~~~~
Private Function CheckRent()

'dimension and assign variables
dim mBoo as boolean
mBoo = false

'if record has been changed, save it
if me.dirty then me.dirty = false

if not me.newrecord then
mBoo = me.zRent
end if

me.subform_controlname.form.controlname.enabled = mBoo

end function
'~~~~~~~~~~~~

where
subform_controlname is the Name property of the SubRent subform control
controlname is the Name property of the SubRent control in the subform

'~~~~~~~~~~~~

on the AfterUpdate event of zRent in the mainform -->
=CheckRent()

on the Current event of the mainform -->
=CheckRent()

Warm Regards,
Crystal
*
:) have an awesome day :)
*
MVP Access
Remote Programming and Training
strive4peace2006 at yahoo.com
*
 

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

Top