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 / July 2007

Tip: Looking for answers? Try searching our database.

Uncheck checkbox

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Marc - 20 Jul 2007 20:14 GMT
Hello,

I have a form with 6 check boxes. Box1 has a default of True. If ANY other
boxes are checked, I would like to automatically uncheck box1. Can you tell
me the best way to do this?

Thanks,
Signature

Marc

Maurice - 20 Jul 2007 20:32 GMT
If you use seperate checkboxes you have to check every box when clicked on.
Fortunately the code is same for every checkbox:

me.checkbox1=not me.checkbox2
me.checkbox1=not me.checkbox3

etc.

put the code in the onclick event of the checkbox.
If you are working on a form and want to do the action as a final check you
could loop through the checkboxes and set checkbox  based on the the values
of the other checkboxes.

hth  
Signature

Maurice Ausum

> Hello,
>
[quoted text clipped - 3 lines]
>
> Thanks,
Marc - 20 Jul 2007 20:44 GMT
Thanks Maurice,

I'm afraid I didn't explain myself very well. Box1 is the only check box I
want this to happen to. The other 5 can be checked in any combination...If I
check box2, box1 gets unchecked, if I check box3, box1 gets unchecked, if
multiple boxes are checked, box1 should be unchecked, etc. Boxes 2-6 can be
all checked, or any combination.

Thanks,
Signature

Marc

> If you use seperate checkboxes you have to check every box when clicked on.
> Fortunately the code is same for every checkbox:
[quoted text clipped - 18 lines]
> >
> > Thanks,
Maurice - 20 Jul 2007 21:16 GMT
Hi Marc,

I misread sorry for that. In the on click of the checkboxes just put:

me.checkbox1=false

This will make checkbox 1 be unchecked based on the choices you make (also
the combinations eg 2 and 5 are checked)

hth
Signature

Maurice Ausum

> Thanks Maurice,
>
[quoted text clipped - 28 lines]
> > >
> > > Thanks,
Klatuu - 20 Jul 2007 21:28 GMT
Put this function in your form's module and change the names to the actual
names of your check boxes.

Private Sub CheckTheBoxes()
   With Me
       If .Check10 + .Check2 + .Check4 + .Check6 + .Check8 <> 0 Then
           .Check0 = False
       Else
           .Check0 = True
       End If
   End With
       
End Sub

Call it in the After Update event of each of the checboxes

Private Sub Check10_AfterUpdate()
   Call CheckTheBoxes
End Sub
Signature

Dave Hargis, Microsoft Access MVP

> Hello,
>
[quoted text clipped - 3 lines]
>
> Thanks,
Marc - 20 Jul 2007 22:46 GMT
Thanks Dave (and Maurice),

That's what I was looking for!

Thanks again,
Signature

Marc

> Put this function in your form's module and change the names to the actual
> names of your check boxes.
[quoted text clipped - 23 lines]
> >
> > Thanks,
 
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.