Results 1 to 5 of 5
  1. #1
    Rawb is offline Expert
    Windows XP Access 2000
    Join Date
    Dec 2009
    Location
    Somewhere
    Posts
    875

    Question Boolean Comparison Not Working

    I have a Form that does a complex import/convert from an Excel Spreadsheet into a Table (well, a set of tables really).

    At one point, I try setting the following WhereCondition on a Recordset:



    Code:
    strCriteriaRawb = "[PatParent]='" & rstPattern("Pattern") & "' And " & _
                      "[PatUseOffset]=" & rstBoMTable("BomUseOffsets")
     rstPatCrossRef.FindFirst strCriteriaRawb
    For some reason, No matter what rstBoMTable("BomUseOffsets") results in, the string strCriteriaRawb always ends in "[PatUseOffset]=False"!

    I've stepped through the code and everything seems to be working perfectly except that one statement, anyone know what's going on?

    P.S.
    To help explain, I've attached a couple of Screenies of me stepping through the code.

  2. #2
    weekend00 is offline I may not be right
    Windows XP Access 2003
    Join Date
    Aug 2010
    Posts
    1,295
    I did not find any problem with you code.

    But I found the code above is different from your screen shot

  3. #3
    Rawb is offline Expert
    Windows XP Access 2000
    Join Date
    Dec 2009
    Location
    Somewhere
    Posts
    875
    Yeah, I was playing around with the code trying to get it to work. The code in my screenshots is converting the Boolean results to a String (so the boolean True would return as the word "True," etc.) whereas the code I posted is my original code.

    I'll update my screenshots to prevent any more confusion.

  4. #4
    weekend00 is offline I may not be right
    Windows XP Access 2003
    Join Date
    Aug 2010
    Posts
    1,295
    I try both way, using cstr or not, they both work fine. not sure what's wrong with yours.
    Are you sure rstBoMTable("BomUseOffsets") returns true? I try in my Access 2003, but could not inspect a result of a function by pointing my mouse on it, how did you inspect the result of rstBoMTable("BomUseOffsets") as you screen shot?

  5. #5
    Rawb is offline Expert
    Windows XP Access 2000
    Join Date
    Dec 2009
    Location
    Somewhere
    Posts
    875
    OK, so I'm stoopid. . .

    I had the evaluation right before the Loop when it should have been inside of it! I was only looking at the first of multiple elementa and just hoping it would be the one that happened to have BomUseOffsets=True!

    >.<

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

Similar Threads

  1. Unique Values and Boolean Fields
    By Triad in forum Forms
    Replies: 1
    Last Post: 07-15-2010, 06:28 PM
  2. Using an Update query to autofill boolean
    By Fuzzyjello in forum Queries
    Replies: 13
    Last Post: 06-09-2010, 10:27 AM
  3. Comparison
    By VICTOR HUGO in forum Access
    Replies: 8
    Last Post: 02-10-2010, 04:32 PM
  4. Time Comparison
    By Larry819 in forum Queries
    Replies: 1
    Last Post: 06-22-2009, 09:26 PM
  5. How to query boolean values from table
    By kevdmiller in forum Queries
    Replies: 2
    Last Post: 11-30-2006, 07:41 PM

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