Results 1 to 6 of 6
  1. #1
    Cheshire101 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Dec 2009
    Posts
    42

    Question Append Query with IIF statement

    Thank you in advance for help given,

    I am trying to run an append query - I need to be able to update the items to another table based on weather a field contains the information to match that field.



    Problem: There are multiple rows of data with True/ False combinations, in others words just because it is true for one does not mean it false for all others.
    Code:
    IIf([Forms]![MainForm]![Field]="Name",True,"")
    This works if it is true only. I am sure the "" needs to be something else just can not figure out. I want it to have no criteria if the IIF statement is false.
    I have tried Like "*" and "*"
    BTW - It can't be False because the item might be true for other columns.
    Last edited by Cheshire101; 09-14-2010 at 03:23 PM. Reason: Additional Information

  2. #2
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    First of all, you have to realize that boolean fields cannot contain a NULL value. It is either true or false, nothing else (unless I'm too tired to think). Now that I think about it though, I'm not sure what it returns if you delete out the default value of FALSE in the table field properties. I know it's not NULL though. So...if you're appending records that are going to contain these types of fields, what you're asking is impossible and might actually throw an error if you try.

  3. #3
    NoellaG's Avatar
    NoellaG is offline VIP
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Jun 2010
    Location
    Belgium
    Posts
    1,171
    Hi,

    YES/NO fields can contain a null value. It just means you don't know if it's true or not, so normally

    IIf([Forms]![MainForm]![Field]="Name",True,Null)
    would have to work.

    grNG

  4. #4
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    Quote Originally Posted by NoellaG View Post
    Hi,

    YES/NO fields can contain a null value. It just means you don't know if it's true or not, so normally

    IIf([Forms]![MainForm]![Field]="Name",True,Null)
    would have to work.

    grNG
    I'd love to see proof of this. I disagree.

  5. #5
    weekend00 is offline I may not be right
    Windows XP Access 2003
    Join Date
    Aug 2010
    Posts
    1,295
    I tried in Access 2003, but could not set to null. only 0 or -1 can stay.

  6. #6
    NoellaG's Avatar
    NoellaG is offline VIP
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Jun 2010
    Location
    Belgium
    Posts
    1,171
    Hi,

    I used the triple state in previous versions of Access, but checking those with Access 2010 there seems to be a problem now. Once I set the triple state to "yes" I don't seem to be able to edit the check box anymore, which could pose aproblem if anyone of the older customers upgrades its app. Using Access help they still talk about the null value of the boolean field though (see attachment) ....


    grNG

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

Similar Threads

  1. append query
    By w_kenny in forum Access
    Replies: 2
    Last Post: 08-24-2010, 05:48 AM
  2. Append Query (Maybe VBA?)
    By justinwright in forum Queries
    Replies: 14
    Last Post: 07-21-2010, 10:31 AM
  3. Append query won't append
    By yelkenli in forum Queries
    Replies: 5
    Last Post: 02-12-2010, 11:19 AM
  4. Append Query
    By aabh in forum Queries
    Replies: 6
    Last Post: 02-02-2010, 04:26 PM
  5. Append Query
    By cotri in forum Queries
    Replies: 1
    Last Post: 01-28-2010, 08:52 PM

Tags for this Thread

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