Results 1 to 4 of 4
  1. #1
    Join Date
    Jul 2010
    Posts
    1

    Unanswered: In/Then Statement in MS Access Query

    I am new to MS Access and I am trying to figure out how to use an IF/Then statement in a query. I have a field titled Doc Status which default is blank. When I run the update query I want it to look to see if anything is in the field if the field is blank I want it to enter 'Not Started' but if there is an existing value I want it to do nothing.

    I have tried multiple ways of trying to write this statement but nothing works. I'm not even sure if I am putting the formula in the correct location either. Any ideas?

    dwk

  2. #2
    Join Date
    Jun 2007
    Location
    Maitland NSW,Australia
    Posts
    388
    In your query in the Update To line of the field to be updated enter "Not Started", then in the Criteria put Is Null.

  3. #3
    Join Date
    Feb 2004
    Location
    New Zealand
    Posts
    1,424
    Provided Answers: 8
    In a query use if and only if

    =iif(con,true,false)
    hope this help

    See clear as mud


    StePhan McKillen
    the aim is store once, not store multiple times
    Remember... Optimize 'til you die!
    Progaming environment:
    Access based on my own environment: DAO3.6/A97/A2000/A2003/A2007/A2010
    VB based on my own environment: vb6 sp5
    ASP based on my own environment: 5.6
    VB-NET based on my own environment started 2007
    SQL-2005 based on my own environment started 2008
    MYLE
    YOUR PASSWORD IS JUST LIKE YOUR TOOTHBRUSH DON'T SHARE IT.

  4. #4
    Join Date
    Feb 2004
    Location
    Chicago, IL
    Posts
    1,312
    Both solutions suggested will work. But Myle's solution answers your question more directly. I would suggest the follwoing:

    Code:
    IIf([Doc Status] & ""="", "Not Started",[Doc Status])
    The subtlety in my code is that the Condition (first parameter) is checking for BOTH null values as well as Empty Strings in Doc Status.

Posting Permissions

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