Results 1 to 9 of 9
  1. #1
    lkdcox is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jun 2014
    Posts
    5

    Make Column Show True False in Table

    Hi there!

    I am new to the forum. I was just wondering if you can make a column show true or false in a table when two other columns in the table match each other? I think the statement would be like this:

    If([Column1] = [Column2], True, False)

    The only problem I am having is that I don't know if it can work in a table or does it just have to be in a query?



    Thanks

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Cannot do that in table in Access 2007 database. Calculate in query.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    lkdcox is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jun 2014
    Posts
    5
    Ok can you show all the data from a table in a query?

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Of course.

    Use the query builder. Pull whatever fields you want down to the grid. Or use the * wildcard to pull them all in one shot. Create another field with your calculation. The result could be like:

    SELECT *, IIf([Column1] = [Column2], True, False) AS IsMatch FROM tablename;
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    lkdcox is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jun 2014
    Posts
    5
    ok that is close to the answer but not quite or maybe I am not entering it right. So I have created the query using my table data with the *. Now If i make a seperate column (column 3) in the query and try to use two columns from the table (ie. Column 1 and Column 2). How would I make that Column 3 reads:

    IIf([Column1] = [Column2], True, False)

  6. #6
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,870
    What are the fields in your table now. You would not normally have a separate field in a table for this calculation.
    You would run a query when you need the value.
    Also using
    IIf([Column1] = [Column2], True, False) indicates a boolean/logical result.

    If you want to see True or False in the output, you would use
    IIf([Column1] = [Column2], "True", "False")

  7. #7
    lfpm062010 is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2013
    Location
    US
    Posts
    415
    oops, little late.

    In design view, just type "IIf([Column1] = [Column2], True, False)" (without quotes).

    Click image for larger version. 

Name:	Capture.JPG 
Views:	12 
Size:	15.0 KB 
ID:	16895

    If you need the literal "True" or "False", then you will need
    IIf([Column1] = [Column2], "True", "False")

  8. #8
    lkdcox is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jun 2014
    Posts
    5
    Oh thank you guys!! It worked!

  9. #9
    lkdcox is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jun 2014
    Posts
    5
    Thank you Ifpm for the screen shot! That really helped

Please reply to this thread with any new information or opinions.

Similar Threads

  1. True And False
    By azhar2006 in forum Forms
    Replies: 4
    Last Post: 12-23-2013, 03:50 AM
  2. Currency fields and if to get true/false
    By Ruegen in forum Programming
    Replies: 1
    Last Post: 09-29-2013, 07:40 PM
  3. Replies: 12
    Last Post: 02-10-2013, 10:13 AM
  4. Yes/No True/False
    By DSTR3 in forum Access
    Replies: 5
    Last Post: 12-04-2010, 05:56 PM
  5. True or false
    By tleec in forum Queries
    Replies: 1
    Last Post: 02-01-2008, 10:41 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums