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 / May 2008

Tip: Looking for answers? Try searching our database.

Check Box

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Sandra - 07 May 2008 16:22 GMT
I have 2 check boxes on my form.  One is "projection" and the other is
"actual".  When doing data entry the user must check one or the other, but
never both.  How do I accomplish that?

Thanks!
Al Campagna - 07 May 2008 16:25 GMT
Sandra,
  Use the OptionGroup Control.  Given any number of check boxes within the
OptionGroup, checking one unchecks all/any of the others.
Signature

   hth
   Al Campagna
   Microsoft Access MVP
   http://home.comcast.net/~cccsolutions/index.html

   "Find a job that you love... and you'll never work a day in your life."

>I have 2 check boxes on my form.  One is "projection" and the other is
> "actual".  When doing data entry the user must check one or the other, but
> never both.  How do I accomplish that?
>
> Thanks!
Sandra - 07 May 2008 17:02 GMT
Great...that works.  So one additional question, how do I make it required
that one or the other be checked?

> Sandra,
>    Use the OptionGroup Control.  Given any number of check boxes within the
[quoted text clipped - 4 lines]
> >
> > Thanks!
KARL DEWEY - 07 May 2008 18:49 GMT
Set the default either on the field or option group.
Signature

KARL DEWEY
Build a little - Test a little

> Great...that works.  So one additional question, how do I make it required
> that one or the other be checked?
[quoted text clipped - 7 lines]
> > >
> > > Thanks!
Sandra - 07 May 2008 18:56 GMT
I might be missing something here.  I don't want to set the default of either
field to YES because I don't want the user to skim over it and not change it
to the other field if necessary.  I want to start out with both fields
defaulting to NO, yet not let them proceed if they don't check one or the
other.  I hope that makes sense.

> Set the default either on the field or option group.
>
[quoted text clipped - 9 lines]
> > > >
> > > > Thanks!
Linq Adams - 07 May 2008 19:09 GMT
Simplest way, in the Table definition, is to make the field attached to the
Option Group Required.

More complicated way would be to run some validation code, in the
Form_BeforeUpdate event, to insure that the Option Group isn't Null.

Signature

There's ALWAYS more than one way to skin a cat!

Answers/posts based on Access 2000/2003

Sandra - 07 May 2008 19:19 GMT
The reason I didn't set the table definition on the field to Required is
because they must choose one box or the other, but never both.  If I set them
both to required it wouldn't work.  So what I need to somehow do is not let
them proceed without checking either "Projection" or "Actual".  

> Simplest way, in the Table definition, is to make the field attached to the
> Option Group Required.
>
> More complicated way would be to run some validation code, in the
> Form_BeforeUpdate event, to insure that the Option Group isn't Null.
Al Campagna - 08 May 2008 05:28 GMT
Sandra,
   You're misunderstanding the Option Group logic.  No matter how many
check boxes there are  in an OptionGroup, the group itself only has one
value.
   The Required property represents the one value returned by the Option
Group
   And if that Option Group is bound to a table field, and that table field
is Required... a new record will not update until one checkbox in the Group
is selected.
Signature

   hth
   Al Campagna
   Microsoft Access MVP
   http://home.comcast.net/~cccsolutions/index.html

   "Find a job that you love... and you'll never work a day in your life."

> The reason I didn't set the table definition on the field to Required is
> because they must choose one box or the other, but never both.  If I set
[quoted text clipped - 9 lines]
>> More complicated way would be to run some validation code, in the
>> Form_BeforeUpdate event, to insure that the Option Group isn't Null.
Rick Brandt - 07 May 2008 19:48 GMT
> I have 2 check boxes on my form.  One is "projection" and the other is
> "actual".  When doing data entry the user must check one or the
> other, but never both.  How do I accomplish that?
>
> Thanks!

You should have ONE field in your table, an OptionGroup on your form with
teo RadioButtons, and make the one field in the table required = yes and
with no default value.

Both RadioButtons will start out "gray" and the user will have to select one
before the record will save.

Signature

Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt   at   Hunter   dot   com

 
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.