RE: How to change ENABLE property of subform by button on Main for
- From: Irv <Irv@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Fri, 10 Jun 2005 07:21:03 -0700
Thanks for your reply Lance.
I have tried your suggestion on one field in the sub form , without success!
The main form is named "frmEdInv",
the subform is "frmInvDet"
the field I tried to change is "Detno".
The code I entered in the Private Sub is
Rem Enable Detail no. field on subform
If Forms!frmEdInv!frmInvDet!Detno.Enable = False Then
Forms!frmEdInv!frmInvDet!Detno.Enable = True
Else: Forms!frmEdInv!frmInvDet!Detno.Enable = False
End If
I receive an error message
" Can't find the field frmInvDet referred in your expression "
Have I missed something? I am fairly new to Access.
Thanks
Irving
"LTofsrud" wrote:
> Hi Irv,
>
> If I understand you correctly, you can use the following code in the button
> event that you want to enable the controls in the subform.
>
> Private Sub cmdEnableControls()
> if Forms!frmMainForm!subEmbeddedForm!txtEmployeeName.enabled = false then
> Forms!frmMainForm!subEmbeddedForm!txtEmployeeName.enabled = true
> else
> Forms!frmMainForm!subEmbeddedForm!txtEmployeeName.enabled = false
> end if
> End Sub
>
> You can either list each control as I did here, or you can iterate through
> the controls collection and after checking its type (i.e. textbox, combo box,
> etc.), then enable or disable appropriately. I prefer this method since you
> don't have to update this section of code if you make changes to the subform.
>
> Hope that helps.
>
> Lance
>
>
>
> "Irv" wrote:
>
> > I am trying to open a form and subform for read only, i.e. with main form
> > fields Locked = True and subform control Enable = False. On the main form I
> > have a button to allow edit of the data. I am able to change the main form
> > fields controls to Locked = False, but cannot find a method to change the
> > subform control Enable = True. Can anyone please help.
.
- Follow-Ups:
- References:
- Prev by Date: Re: Use table in Replace function
- Next by Date: Re: How to control Report Preview properties at runtime
- Previous by thread: RE: How to change ENABLE property of subform by button on Main form
- Next by thread: RE: How to change ENABLE property of subform by button on Main for
- Index(es):