Visible property on another form (1 Viewer)

cpampas

Registered User.
Local time
Today, 08:42
Joined
Jul 23, 2012
Messages
218
Inside of form "frmMain", I have two forms :
frmSearch
frmList

from a button in frmSearch, I want to change the visible property of controls in frmList
I tried the following, wich wont work

Code:
If curr = 1 Then
     Forms!frmList.debitoPH.Visible = False
     Forms!frmList.Debito.Visible = True
Else
     Forms!frmList.debitoPH.Visible = true
     Forms!frmList.Debito.Visible = false
End If

Any thoughts on what I am doing wrong
Thanks
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 11:42
Joined
May 21, 2018
Messages
8,529
you cannot refer to a subform by its name, since you could have many instances of a subform. You need to reference through the subform control.

me.SubformControlList.Form.debitoPh.visible = false
where SubformControlList is your actual name of the subform control and not necessarily the name of the form inside the subform control. By default the two names are the same, but not always.

or in this case
me.SubformControlList.Form.debittoPh.visible = (curr<> 1)
me.subformControlist.form.debitTo.visible = (curr = 1)
 

cpampas

Registered User.
Local time
Today, 08:42
Joined
Jul 23, 2012
Messages
218
That worked, thanks
 

Users who are viewing this thread

Top Bottom