Re: convert "yes" to '2' then add all fields

From: Douglas J. Steele (NOSPAM_djsteele_at_NOSPAM_canada.com)
Date: 10/25/04

  • Next message: PaulFort: "Re: convert "yes" to '2' then add all fields"
    Date: Mon, 25 Oct 2004 15:48:14 -0400
    
    

    Are Yes and No text fields, or is that a Boolean field that's formatted as
    Yes/No, rather than True/False?

    In either case, you can create a query that has a computed field in it: the
    details will be a little different, though.

    Create the Select query and drag whatever fields you care about into the
    grid. Pick an empty column in the grid, put your cursor in the Field row of
    that column and hit Shift-F2 to bring up the Zoom box.

    In the Zoom box, type:

    Total: IIf(Len(Trim([tall] & "")) = 0, 0, IIf([tall] ="yes", 2, 1)) +
    IIf(Len(Trim([strong] & "")) = 0, 0, IIf([strong] = "yes", 2, 1)) +
    IIf(Len(Trim([heavy] & "")) = 0, 0, IIf([heavy] ="yes", 2, 1)) +
    IIf(Len(Trim([thin] &"")), 0 , IIf([thin] ="yes", 2, 1))

    if they're text, and

    Total: IIf(IsNull([tall]), 0, IIf([tall], 2, 1)) + IIf(IsNull([strong]), 0,
    IIf([strong], 2, 1)) + IIf(IsNull([heavy]), 0, IIf([heavy], 2, 1)) +
    IIf(IsNull([thin]), 0 , IIf([thin], 2, 1))

    if they're boolean.

    --
    Doug Steele, Microsoft Access MVP
    http://I.Am/DougSteele
    (No private e-mails, please)
    "PaulFort" <PaulFort@discussions.microsoft.com> wrote in message
    news:9F126709-DBFA-48FB-9922-A2B8D82E6400@microsoft.com...
    > Hi All,
    > This should be simple....
    > To make my question clear, I put a demo table here:
    > http://tallahasseech.org/accessquestion.htm
    >
    > - I want to assign the number '2' to each yes and  assign '1' to a "no"
    >
    > - I want to then add up all the numbers in the fields for each record
    (person)
    >
    > > So the answers for my demo would be:
    > tom =  7 (2+2+2+1)
    > tim =  6 (1+2+2+1)
    > james = 0
    >
    > How do I do this.
    > I appreciate the help.
    > Paul
    >
    >
    

  • Next message: PaulFort: "Re: convert "yes" to '2' then add all fields"

    Relevant Pages

    • Re: Filenames to a field
      ... I have saved the query with the exp. ... > where the jpg file already existed. ... Drag field that is to contain the JPG file names onto the grid. ... Go to the next empty column on the grid. ...
      (microsoft.public.access.externaldata)
    • RE: Display fields Limited on Values
      ... "Duane Hookom" wrote: ... boolean field names. ... I created the database yesterday. ... I also made another query that displays the ...
      (microsoft.public.access.queries)
    • RE: Display fields Limited on Values
      ... person/requirement should create a single record in a related table. ... boolean field names. ... I also made another query that displays the ... I have created a rather lengthy query to display everyone who has ...
      (microsoft.public.access.queries)
    • Re: Trying to get fancy
      ... I have always added a Boolean field to such tables and used a fake listbox ... go through the selection process again. ... They check what they want to see and run the report from the form. ... No code to write and you just add a Field = True to teh query. ...
      (microsoft.public.access.formscoding)
    • Re: Update Queries and Record Locks
      ... The value of the boolean field is completely dependent on whether or not DateCompleted has a value. ... Field: CompletedYN: DateCompleted Is Not Null ... My problem is I have multiple users in a form that runs off tblOrders that are in records as this query is happening. ...
      (microsoft.public.access.modulesdaovba)