UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Make Control Visible, Access 2016    
 
   
mike60smart
post Jul 10 2018, 01:20 PM
Post#1


UtterAccess VIP
Posts: 12,650
Joined: 6-June 05
From: Dunbar,Scotland


Hi Everyone

I have a Main Form named "frmInspectionDates"

A Subform named "frmLocationssubform"

Within the Subform I have a further 2 Nested Subforms

Nested subform 1 named "frmLocationsSubform"

Nested Subform 2 named "frmLocationMaintenanceItemssubform"

What I am trying to achieve is when I update a Control named "ItemDescription" on Nested Subform 1, I want to make visible on Nested Subform 2 a Control named "cboFloorType"

I am trying the code below but I get this error:-

Attached File  error.JPG ( 18.79K )Number of downloads: 0


Any help appreciated

[Code]
If Me.ItemDescription = "Flooring" Then
Forms![frmInspectionDates]![frmLocationssubform]![frmLocationMaintenanceItemssubform]![frmLocationOtherItemssubform].Form.[cboFloorType].Visible = True
Else
Forms![frmInspectionDates]![frmLocationssubform]![frmLocationMaintenanceItemssubform]![frmLocationOtherItemssubform].Form.[cboFloorType].Visible = True
End If
[Code/]

--------------------
Hope this helps?

Mike

Get happiness out of your work or you may never know what happiness is.

Go to the top of the page
 
BruceM
post Jul 10 2018, 01:30 PM
Post#2


UtterAccess VIP
Posts: 7,502
Joined: 24-May 10
From: Downeast Maine


You need to use the Form property of every subform control, not just the last one:

Forms![frmInspectionDates]![frmLocationssubform].Form![frmLocationMaintenanceItemssubform].Form![frmLocationOtherItemssubform].Form.[cboFloorType].Visible = True

frmLocationMaintenanceItemssubform is on the form that is contained by the frmLocationsubform subform control, not on the subform control itself. And so forth down the line.
Go to the top of the page
 
ADezii
post Jul 10 2018, 01:36 PM
Post#3



Posts: 1,964
Joined: 4-February 07
From: USA, Florida, Delray Beach


I am assuming that you are placing this Code in the AfterUpdate() Event of [ItemDescription] which is on the 1st Sub-Form. Since you are executing the Code in this context you may be able to use the following syntax:
CODE
Me![frmLocationMaintenanceItemsSubform].Form![cboFloorType].Visible = True

This post has been edited by ADezii: Jul 10 2018, 01:38 PM
Go to the top of the page
 
BruceM
post Jul 10 2018, 01:39 PM
Post#4


UtterAccess VIP
Posts: 7,502
Joined: 24-May 10
From: Downeast Maine


I believe you are correct. I lost track of the subforms.
Go to the top of the page
 
mike60smart
post Jul 11 2018, 11:09 AM
Post#5


UtterAccess VIP
Posts: 12,650
Joined: 6-June 05
From: Dunbar,Scotland


Hi Bruce

Sorry for the delay in getting back to you.

Tried your suggested solution and I get the following error:-

Attached File  error.JPG ( 19.11K )Number of downloads: 0



--------------------
Hope this helps?

Mike

Get happiness out of your work or you may never know what happiness is.

Go to the top of the page
 
mike60smart
post Jul 11 2018, 11:12 AM
Post#6


UtterAccess VIP
Posts: 12,650
Joined: 6-June 05
From: Dunbar,Scotland


Hi Adezii

I tried your recommendation and get the same error:-

Attached File  error.JPG ( 19.11K )Number of downloads: 0

--------------------
Hope this helps?

Mike

Get happiness out of your work or you may never know what happiness is.

Go to the top of the page
 
BruceM
post Jul 11 2018, 12:10 PM
Post#7


UtterAccess VIP
Posts: 7,502
Joined: 24-May 10
From: Downeast Maine


Mike, please show the entire expression you used.
Go to the top of the page
 
tina t
post Jul 11 2018, 12:34 PM
Post#8



Posts: 5,455
Joined: 11-November 10
From: SoCal, USA


hi Mike, if i understand your first post correctly, you have a mainform, it has one subform, and the subform in turn has two sub-subforms (not one inside the other, but "side by side"). and you're updating a control in one sub-subform, and want to change the Visible property of a control in the other sub-subform.

if all the above is correct, then try adding the line of code below to the AfterUpdate event of control ItemDescription in sub-subform frmLocationsSubform.

Me.Parent!frmLocationMaintenanceItemssubform.Form!cboFloorType.Visible = True

note that frmLocationMaintenanceItemssubform must be the name of the subform control that "holds" the second sub-subform. to make sure, open the mainform in Design view and navigate to the first sub-subform; click once on it to select it; and then look at the Name property in the Properties list. that name is the one you need to use in the line of code above.

hth
tina
This post has been edited by tina t: Jul 11 2018, 12:35 PM

--------------------
"the wheel never stops turning"
Go to the top of the page
 
jwhite
post Jul 11 2018, 01:26 PM
Post#9


UtterAccess VIP
Posts: 5,817
Joined: 31-August 06
From: North Carolina, USA


A good guide: http://access.mvps.org/access/forms/frm0031.htm

--------------------
Go to the top of the page
 
mike60smart
post Jul 11 2018, 01:53 PM
Post#10


UtterAccess VIP
Posts: 12,650
Joined: 6-June 05
From: Dunbar,Scotland


Hi Bruce

This is the expression in the After Update of the Control "cboStatus" (My original Control ItemDescription was not correct):-

If Me.ItemDescription = "Flooring" Then
Form![frmInspectionDates]![frmLocationssubform].Form![frmLocationMaintenanceItemssubform].Form![frmLocationOtherItemssubform].Form![cboFloorType].Visible = True

End If


--------------------
Hope this helps?

Mike

Get happiness out of your work or you may never know what happiness is.

Go to the top of the page
 
ADezii
post Jul 11 2018, 02:01 PM
Post#11



Posts: 1,964
Joined: 4-February 07
From: USA, Florida, Delray Beach


Are you using names of the Sub-Form or the Sub-Form Control itself?
Go to the top of the page
 
mike60smart
post Jul 11 2018, 02:02 PM
Post#12


UtterAccess VIP
Posts: 12,650
Joined: 6-June 05
From: Dunbar,Scotland


Hi Tina

I have a Main Form - frmInspectionDates

A Subform - frmLocationsSubform

Nested inside -frmLocationsSubform I have 2 subforms side by side

The Left one is - frmLocationMaintenanceItemsSubform

The right hand one is - frmLocationOtherItemsSubform


The code I am trying to run is on the After Update of cboStatus which is in the Left hand subform

If the Control Item description is showing "Flooring" Then

the Control cboFloorType will be shown on the Right Hand subform

Hope this is as clear as mud?


Attached File  Forms.jpg ( 87.79K )Number of downloads: 7




--------------------
Hope this helps?

Mike

Get happiness out of your work or you may never know what happiness is.

Go to the top of the page
 
ADezii
post Jul 11 2018, 02:19 PM
Post#13



Posts: 1,964
Joined: 4-February 07
From: USA, Florida, Delray Beach


Giving it another shot, Mike:
CODE
If Me![ItemDescription] = "Flooring" Then
  'Since both Sub-Forms have the same Parent (frmLocationsSubform)
  Me.Parent![frmLocationOtherItemsSubform].Form![cboFloorType].Visible = True
End If
Go to the top of the page
 
mike60smart
post Jul 11 2018, 02:49 PM
Post#14


UtterAccess VIP
Posts: 12,650
Joined: 6-June 05
From: Dunbar,Scotland


Hi Tina and Everyone

Your suggestion works as follows:-

If Me.ItemDescription = "Flooring" Then
Me.Parent!frmLocationOtherItemssubform.Form!cboFloorType.Visible = True
Me.Parent!frmLocationOtherItemssubform.Form!Floor_Type_Label.Visible = True
Else
Me.Parent!frmLocationOtherItemssubform.Form!cboFloorType.Visible = False
Me.Parent!frmLocationOtherItemssubform.Form!Floor_Type_Label.Visible = False

End If

Many thanks for all the help

thanks.gif

--------------------
Hope this helps?

Mike

Get happiness out of your work or you may never know what happiness is.

Go to the top of the page
 
tina t
post Jul 11 2018, 06:08 PM
Post#15



Posts: 5,455
Joined: 11-November 10
From: SoCal, USA


good job getting it to work for you, Mike! and you're welcome, we were all happy to help. :) tina

--------------------
"the wheel never stops turning"
Go to the top of the page
 
ADezii
post Jul 12 2018, 07:05 AM
Post#16



Posts: 1,964
Joined: 4-February 07
From: USA, Florida, Delray Beach


thumbup.gif Glad you got it working, Mike. One last thing you may wish to consider is tidying up your Code (NOT Tested):
CODE
Dim frm As Access.Form

Set frm = Me.Parent!frmLocationOtherItemssubform.Form

frm!cboFloorType.Visible = (Me.ItemDescription = "Flooring")
frm!Floor_Type_Label.Visible = (Me.ItemDescription = "Flooring")

This post has been edited by ADezii: Jul 12 2018, 07:05 AM
Go to the top of the page
 
mike60smart
post Jul 12 2018, 08:13 AM
Post#17


UtterAccess VIP
Posts: 12,650
Joined: 6-June 05
From: Dunbar,Scotland


Hi Adezii

I am carrying out the process for a number of ItemDescriptions so would your suggested code go in place of my current After Update??


--------------------
Hope this helps?

Mike

Get happiness out of your work or you may never know what happiness is.

Go to the top of the page
 
ADezii
post Jul 12 2018, 09:02 AM
Post#18



Posts: 1,964
Joined: 4-February 07
From: USA, Florida, Delray Beach


QUOTE
I am carrying out the process for a number of ItemDescriptions so would your suggested code go in place of my current After Update??

Yes, but would need t be expanded to accommodate more Descriptions.
Go to the top of the page
 


Custom Search
RSSSearch   Top   Lo-Fi    17th July 2018 - 10:13 PM