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
> Show/hide Textbox, Access 2010    
 
   
kolos
post Mar 8 2020, 12:17 PM
Post#1



Posts: 30
Joined: 18-December 07



Hello everyone,

does anyone know a shorter and easier way...
I want based on the value of a one texbox show/hide several others texboxes.
So i try on this way...

If Me.M = "0" Then
Me.Label405.Visible = False
Me.M.Visible = False
Me.Labe1369.Visible = False
Me.Text407.Visible = False
etc, etc

Else
Me.Label405.Visible = True
Me.M.Visible = True
Me.Label369.Visible = True
Me.Text407.Visible = True
End if
etc, etc..

And this working fine. But is to complex.

So i try something like this

Dim Visible As Boolean

Select M.Value
Case "0", "3"
Visible = False
Case Else
Visible = True
End Select

Me.Label405.Visible = Visible
etc, rtc...

But this not working ...

So, if someone have a idea...
Go to the top of the page
 
theDBguy
post Mar 8 2020, 12:26 PM
Post#2


UA Moderator
Posts: 78,481
Joined: 19-June 07
From: SunnySandyEggo


Maybe something like?

CODE
Me.Label405.Visible = Me.Me <> 0
etc.

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Access Website | Access Blog | Email
Go to the top of the page
 
kolos
post Mar 8 2020, 12:30 PM
Post#3



Posts: 30
Joined: 18-December 07



Right in the center of the target.
Short and simple.
Well done !!!
notworthy.gif
Go to the top of the page
 
theDBguy
post Mar 8 2020, 01:15 PM
Post#4


UA Moderator
Posts: 78,481
Joined: 19-June 07
From: SunnySandyEggo


Hi. Glad we could assist. Good luck with your project.

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Access Website | Access Blog | Email
Go to the top of the page
 
tina t
post Mar 8 2020, 04:01 PM
Post#5



Posts: 6,689
Joined: 11-November 10
From: SoCal, USA


just a point to consider: having controls appear and disappear between records (i assume), can be disconcerting to users. an alternative would be to disable/enable the controls instead of hiding them, using the same code that DBguy already provided - just change from .Visible to .Enabled.

hth
tina

--------------------
"the wheel never stops turning"
Go to the top of the page
 
kolos
post Mar 9 2020, 01:32 PM
Post#6



Posts: 30
Joined: 18-December 07



Good thinking Tina.
The reason I opted for the show / hide option is because I don't want blank boxes to appear on the form.
These are the results of the calculation, and depending on the initial entries, some fields have no value.
Go to the top of the page
 


Custom Search


RSSSearch   Top   Lo-Fi    11th July 2020 - 06:45 AM