Results 1 to 6 of 6
  1. #1
    Join Date
    Jan 2005
    Posts
    18

    Unanswered: Simple Query help needed please!

    I have a query with 3 fields - IDnumber, Video, Tape.

    Video and Tape are both Yes or No from a combobox.

    I want to add a 4th field to the query called "both" where if the fields Video and Tape each say "yes" then the "both" field displays "both".

    Im sure its fairly easy to do, im just not getting it to work!

  2. #2
    Join Date
    Jun 2004
    Location
    Florida, US
    Posts
    521
    SELECT IDnumber, Video, Tape, Both as (Video and Tape) FROM YourTableNameHere
    ghozy.

  3. #3
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    Quote Originally Posted by ghozy
    SELECT IDnumber, Video, Tape, Both as (Video and Tape) FROM YourTableNameHere
    Close ...

    SELECT IDnumber, Video, Tape, IIF ((Video=True) AND (Tape=True),"Both","") AS Both FROM ...
    Back to Access ... ADO is not the way to go for speed ...

  4. #4
    Join Date
    May 2004
    Location
    New York State
    Posts
    1,178
    Closer, but the "Both" field will probably be Boolean as well, not text. Ergo:

    SELECT IDNumber, Tape, Video, IIF((Tape) And (Video),True,False) As Both FROM TableName;

    Sam

  5. #5
    Join Date
    Jun 2004
    Location
    Florida, US
    Posts
    521
    Quote Originally Posted by Sam Landy
    Closer, but the "Both" field will probably be Boolean as well, not text. Ergo:

    SELECT IDNumber, Tape, Video, IIF((Tape) And (Video),True,False) As Both FROM TableName;

    Sam
    I believe (Tape and Video) operation already returns boolean value, there is no need to use iif function for that. . ofcourse in query view it will show integer values ( 0, -1) instead of string representation. you can overcome this issue with formatting the textbox or with M Owen's solution, or assigning a checkbox to the field instead of textbox.
    Last edited by ghozy; 02-02-05 at 13:26. Reason: addtion
    ghozy.

  6. #6
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    Quote Originally Posted by Sam Landy
    Closer, but the "Both" field will probably be Boolean as well, not text. Ergo:

    SELECT IDNumber, Tape, Video, IIF((Tape) And (Video),True,False) As Both FROM TableName;

    Sam
    Sam,

    Uh ... no ...
    ... each say "yes" then the "both" field displays "both".
    Back to Access ... ADO is not the way to go for speed ...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •