Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms Programming / January 2005

Tip: Looking for answers? Try searching our database.

how do i use checkboxes to show or hide other controls on a form?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Radu - 18 Jan 2005 22:25 GMT
when form loads, I need to see only two checkboxes.  When I check the first
one, two textboxes needs to show.  When I move to the next record, I want the
two checkboxes to be displayed by themselves again.  

Now, I have 200 records in the table.  If the first Checkbox is checked,
display the two textboxes, if the second checkbox is checked, don't display
the two textboxes.  

How can I do this for all the records in the table when I browse the recs on
the form.

thank you.

Radu
tina - 18 Jan 2005 22:47 GMT
assuming that the two checkboxes on the form are unbound, try the following:

in the form's Current event procedure, add the following, as

   Me!FirstTextboxName.Visible = False
   Me!SecondTextboxName.Visible = False

actually, you don't need 2 checkboxes to show/hide the textboxes - you only
need one. since a checkbox represents True/False, On/Off, Yes/No, you can
checkmark a single checkbox to show the textboxes, and un-check the checkbox
to hide them again. add the following code to the checkbox control's
AfterUpdate event procedure, as

   Me!FirstTextboxName.Visible = Me!CheckboxName
   Me!SecondTextboxName.Visible = Me!CheckboxName

hth

> when form loads, I need to see only two checkboxes.  When I check the first
> one, two textboxes needs to show.  When I move to the next record, I want the
[quoted text clipped - 10 lines]
>
> Radu
PC Datasheet - 18 Jan 2005 22:54 GMT
First, you only need one checkbox! In design view, set the visible property
of both textboxes to No. Put the following code in the AfterUpdate event of
the checkbox:
If Me!NameOfCheckbox = True
   Me!NameOfTextbox1.Visible = True
   Me!NameOfTextbox2.Visible = True
Else
   Me!NameOfTextbox1.Visible = False
   Me!NameOfTextbox2.Visible = False
End If

Put the following code in the OnCurrent event of the form:
Me!NameOfTextbox1.Visible = False
Me!NameOfTextbox2.Visible = False

--
                                       PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
                             resource@pcdatasheet.com
                                www.pcdatasheet.com

> when form loads, I need to see only two checkboxes.  When I check the first
> one, two textboxes needs to show.  When I move to the next record, I want the
[quoted text clipped - 10 lines]
>
> Radu
Douglas J. Steele - 18 Jan 2005 23:02 GMT
Or simply

Me!NameOfTextbox1.Visible = Me!NameOfCheckbox
Me!NameOfTextbox2.Visible = Me!NameOfCheckbox

Signature

Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)

> First, you only need one checkbox! In design view, set the visible
> property
[quoted text clipped - 37 lines]
>>
>> Radu
PC Datasheet - 19 Jan 2005 00:38 GMT
Doug,

I actually like to use this code but I have found dabblers in Access have a
very hard time understanding how it works!

Steve
PC Datasheet

> Or simply
>
[quoted text clipped - 47 lines]
> >>
> >> Radu
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.