|
 |
access thread: Setting text box visibility
Message #1 by "Charles Price" <cprice@w...> on Tue, 21 May 2002 02:29:31
|
|
Need your help again.
I have 68 text boxes but only require a combination of the 68 depending on
other requirements. They are named con1, con2 - con68 and I have been
trying to write a macro to hide the ones not required. I think this is
simple but after hours of reading help files and trying various
combinations of code I just can't get it. If someone could set me in the
right direction I would greatly appreciate the help. I am a novice and
really don't like to bother you guys but,HELP.
Charlie
Message #2 by "John Ruff" <papparuff@c...> on Mon, 20 May 2002 18:35:35 -0700
|
|
How are your "other requirements"? Are they comboboxes or are the other
textboxes and what are their names
John Ruff - The Eternal Optimist :-)
Always Looking for a Contract Opportunity
xxx.xxx.xxxx
9306 Farwest Dr SW
Lakewood, WA 98498
-----Original Message-----
From: Charles Price [mailto:cprice@w...]
Sent: Tuesday, May 21, 2002 2:30 AM
To: Access
Subject: [access] Setting text box visibility
Need your help again.
I have 68 text boxes but only require a combination of the 68 depending
on
other requirements. They are named con1, con2 - con68 and I have been
trying to write a macro to hide the ones not required. I think this is
simple but after hours of reading help files and trying various
combinations of code I just can't get it. If someone could set me in the
right direction I would greatly appreciate the help. I am a novice and
really don't like to bother you guys but,HELP.
Charlie
Message #3 by "Amy Wyatt" <amyw@c...> on Tue, 21 May 2002 14:04:01
|
|
Charlie,
It would probably be easier to do this type of procedure in regular code
rather than a Macro. It will be faster and easier to edit. It all depends
on your criteria but if you can read that value into a function then you
can use the Select Case method to do the showing and hiding of controls.
A quick Example, say you have 2 criteria. On hides the even controls, one
hides the odd controls. This is what the function would look kind of like
this.
Function HideAppropriateControls(strCriteria as String)
Dim strControlName as String
Dim intCounter as Integer
Select Case strCriteria
Case "Odd"
For intCounter = 1 to 68 Step 2
strControlName="con" & intCounter
Me(strControlName).Visible=True
strControlName="con" & intCounter + 1
Me(strControlName).Visible=False
Next intCounter
Case Else
For intCounter = 2 to 68 Step 2
strControlName="con" & intCounter -1
Me(strControlName).Visible=Fale
strControlName="con" & intCounter
Me(strControlName).Visible=True
Next intCounter
End Select
End Function
Of course if you are not using the numbers to determine the criteria you
may have to use something other than strControlName to determine whether
the control needs to be visible or not. If I knew the details I could be
more specific but hopefully this will help get you started.
PS. I used a Function rather than a Sub because it can be called from a
controls event more easily.
Amy
> Need your help again.
> I have 68 text boxes but only require a combination of the 68 depending
on
o> ther requirements. They are named con1, con2 - con68 and I have been
t> rying to write a macro to hide the ones not required. I think this is
s> imple but after hours of reading help files and trying various
c> ombinations of code I just can't get it. If someone could set me in the
r> ight direction I would greatly appreciate the help. I am a novice and
r> eally don't like to bother you guys but,HELP.
> Charlie
Message #4 by "Wesley Kendrick" <wez.k@n...> on Tue, 21 May 2002 22:36:08 +0100
|
|
Hi Charles, you can do this very easily in Visual Basic without writing
macros.
What you do is to set the 'visible' property of the control with this code:-
[nameofcontrol].visible = true (shows the control)
[nameofcontrol].visible = false (hides the control)
regards, Wesley Kendrick
----- Original Message -----
From: "Charles Price" <cprice@w...>
To: "Access" <access@p...>
Sent: Tuesday, May 21, 2002 2:29 AM
Subject: [access] Setting text box visibility
> Need your help again.
>
> I have 68 text boxes but only require a combination of the 68 depending on
> other requirements. They are named con1, con2 - con68 and I have been
> trying to write a macro to hide the ones not required. I think this is
> simple but after hours of reading help files and trying various
> combinations of code I just can't get it. If someone could set me in the
> right direction I would greatly appreciate the help. I am a novice and
> really don't like to bother you guys but,HELP.
>
> Charlie
>
|
|
 |