Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!

Yes/No Check Box

Discussion in 'Information Technology' started by Levans digital, Jul 28, 2006.

  1. Levans digital

    Levans digital
    Expand Collapse
    Guest

    I have checkbox named "Released"
    Here is what I am doing
    LocationStatus:
    IIf([Released?]="yes","Delivered",IIf(Not
    IsNull([Location]),"Warehouse/Yard","Intransit"))

    This expression work correctly when the datatype is changed from a checkbox
    to a text box and "yes" is typed in the textbox but is gives an error when
    when it is a yes/no datatype and when its is checked. I think the problem is
    the "yes" in the expression for the yes/no datatype I tried "1", I tried "-1"
    and others. Please help
     
  2. Loading...


  3. Rick Brandt

    Rick Brandt
    Expand Collapse
    Guest

    Levans digital wrote:
    > I have checkbox named "Released"
    > Here is what I am doing
    > LocationStatus:
    > IIf([Released?]="yes","Delivered",IIf(Not
    > IsNull([Location]),"Warehouse/Yard","Intransit"))
    >
    > This expression work correctly when the datatype is changed from a
    > checkbox to a text box and "yes" is typed in the textbox but is gives
    > an error when when it is a yes/no datatype and when its is checked.
    > I think the problem is the "yes" in the expression for the yes/no
    > datatype I tried "1", I tried "-1" and others. Please help


    Yes/No fields can be formatted to display the words "Yes" and "No", but that
    does not make them "equal" to that display value. Access is pretty
    forgiving of this, but you don't want quotes around the value if testing for
    True/False or Yes/No.

    I prefer to test for 0 (false) or not equal to zero (true) and do not use
    quotes.

    IIf([Released?]<>0,"Delivered",IIf(Not
    IsNull([Location]),"Warehouse/Yard","Intransit"))

    You "could" test for zero and/or negative one, but other systems like SQL
    Server store a positive one for True whereas Access/Jet uses negative one
    for True. Zero being equivelant to False is the same in Access/Jet, VBA
    code, and SQL Server so always testing for zero or non-zero will not break
    if you ever move your data to SQL Server.

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

    fredg
    Expand Collapse
    Guest

    On Mon, 5 Jun 2006 11:23:02 -0700, Levans digital wrote:

    > I have checkbox named "Released"
    > Here is what I am doing
    > LocationStatus:
    > IIf([Released?]="yes","Delivered",IIf(Not
    > IsNull([Location]),"Warehouse/Yard","Intransit"))
    >
    > This expression work correctly when the datatype is changed from a checkbox
    > to a text box and "yes" is typed in the textbox but is gives an error when
    > when it is a yes/no datatype and when its is checked. I think the problem is
    > the "yes" in the expression for the yes/no datatype I tried "1", I tried "-1"
    > and others. Please help


    Is the Field named [Released] or [Released?] ?

    A check box is a Boolean datatype, i.e. 0 or -1 or Yes or No or True
    or False, etc., a number not Text "-1","Yes", "True" etc.

    LocationStatus: IIf([Released]=-1,"Delivered",IIf(Not
    IsNull([Location]),"Warehouse/Yard","Intransit"))

    --
    Fred
    Please respond only to this newsgroup.
    I do not reply to personal e-mail
     
  5. Levans digital

    Levans digital
    Expand Collapse
    Guest

    Hey Thanks very much it works.

    One more question. I would like to create a query to select only the
    "released?" goods, therefore all the fields that are checked on the yes/no
    box.
    And another query to select the "released?" goods that arnt check

    What must I put in the crieteria column of the query. both queries I guess
    its not yes and no or true and false or -1 and 0 ????

    thanks

    "Rick Brandt" wrote:

    > Levans digital wrote:
    > > I have checkbox named "Released"
    > > Here is what I am doing
    > > LocationStatus:
    > > IIf([Released?]="yes","Delivered",IIf(Not
    > > IsNull([Location]),"Warehouse/Yard","Intransit"))
    > >
    > > This expression work correctly when the datatype is changed from a
    > > checkbox to a text box and "yes" is typed in the textbox but is gives
    > > an error when when it is a yes/no datatype and when its is checked.
    > > I think the problem is the "yes" in the expression for the yes/no
    > > datatype I tried "1", I tried "-1" and others. Please help

    >
    > Yes/No fields can be formatted to display the words "Yes" and "No", but that
    > does not make them "equal" to that display value. Access is pretty
    > forgiving of this, but you don't want quotes around the value if testing for
    > True/False or Yes/No.
    >
    > I prefer to test for 0 (false) or not equal to zero (true) and do not use
    > quotes.
    >
    > IIf([Released?]<>0,"Delivered",IIf(Not
    > IsNull([Location]),"Warehouse/Yard","Intransit"))
    >
    > You "could" test for zero and/or negative one, but other systems like SQL
    > Server store a positive one for True whereas Access/Jet uses negative one
    > for True. Zero being equivelant to False is the same in Access/Jet, VBA
    > code, and SQL Server so always testing for zero or non-zero will not break
    > if you ever move your data to SQL Server.
    >
    > --
    > Rick Brandt, Microsoft Access MVP
    > Email (as appropriate) to...
    > RBrandt at Hunter dot com
    >
    >
    >
    >
     
  6. Rick Brandt

    Rick Brandt
    Expand Collapse
    Guest

    Levans digital wrote:
    > Hey Thanks very much it works.
    >
    > One more question. I would like to create a query to select only the
    > "released?" goods, therefore all the fields that are checked on the
    > yes/no box.
    > And another query to select the "released?" goods that arnt check
    >
    > What must I put in the crieteria column of the query. both queries I
    > guess its not yes and no or true and false or -1 and 0 ????


    For all the checked ones use a criteria of...

    <> 0

    For all of the unchecked ones use...

    0


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

Share This Page