Results 1 to 7 of 7
  1. #1
    alecmat is offline Novice
    Windows 8 Access 2007
    Join Date
    Mar 2013
    Posts
    10

    AND OR Formula

    Afternoon,

    I am trying to write a formula in ACCESS for the first time. I would like to write the below, its a basic IF Then statement that involves "OR" and "And".. In Excel it would be:

    if(AND(OR(Freight terms=PP, Freight terms=PC, Freight terms=CC),Arrive in Yard>0,Current Appt>End ETA,1,2))

    But how do you write in in Access? (the below is my attempt)

    = iif(( [Freight Terms]="PP" OR [Freight Terms]="PC" OR [Freight Terms]="CC" AND [Arrive in Yard] >0 And [Current Appt] > [End ETA] ,"1",2))

    Any asistance would be appreciated.



    Thanks
    -Alec

  2. #2
    alecmat is offline Novice
    Windows 8 Access 2007
    Join Date
    Mar 2013
    Posts
    10
    Correction on my first post: Cleaned up verison of the formula is below, which is functional, but does not return the desired data...What is the best way to say "if a cell is not blank" in Access ? I am using ">0", but that may not be best in Access........ Thanks Again!

    Expr1: IIf([Freight Terms]="PP" Or [Freight Terms]="PC" Or [Freight Terms]="CC" And [Arrive in Yard]>0 And [Current Appt]>[End ETA],"1","2")

  3. #3
    alansidman's Avatar
    alansidman is offline Indifferent
    Windows 7 32bit Access 2010 32bit
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,538
    Is Not Null. A point to keep in mind in Access, there is no such thing as a blank field. It is either Null or not Null. In Excel, if you have a space or "" in a cell, it is considered to be empty or equal to zero. In Access this is not the case as it is deemed to hold data. It truly must be null.

  4. #4
    alecmat is offline Novice
    Windows 8 Access 2007
    Join Date
    Mar 2013
    Posts
    10
    Quote Originally Posted by alansidman View Post
    Is Not Null. A point to keep in mind in Access, there is no such thing as a blank field. It is either Null or not Null. In Excel, if you have a space or "" in a cell, it is considered to be empty or equal to zero. In Access this is not the case as it is deemed to hold data. It truly must be null.
    Ok Thanks for the clarification.

  5. #5
    alecmat is offline Novice
    Windows 8 Access 2007
    Join Date
    Mar 2013
    Posts
    10
    Alansidman,

    Sadly, I received an error whey I attempted the "Is Not Null" in the formula...please see the below:

    I simply want to say if that is the below cell (Freight Terms) is NOT BLANK (i.e, there is data in the cell), then to give me a 1, if not, give me a 2. How would I write that?

    I am getting an error that states "undefined function"IsNotNull" in expression", and I am trying to understand why. Unlike Excel, the IsBlank() function does not appear to work...Any assistance would be appreciated

    Expr2: IIf(IsNotNull([Freight Terms]),"1","2")

    Thank You,

  6. #6
    alecmat is offline Novice
    Windows 8 Access 2007
    Join Date
    Mar 2013
    Posts
    10
    Quote Originally Posted by alecmat View Post
    Alansidman,

    Sadly, I received an error whey I attempted the "Is Not Null" in the formula...please see the below:

    I simply want to say if that is the below cell (Freight Terms) is NOT BLANK (i.e, there is data in the cell), then to give me a 1, if not, give me a 2. How would I write that?

    I am getting an error that states "undefined function"IsNotNull" in expression", and I am trying to understand why. Unlike Excel, the IsBlank() function does not appear to work...Any assistance would be appreciated

    Expr2: IIf(IsNotNull([Freight Terms]),"1","2")

    Thank You,
    Upon researching Access functions, I have not come across Is Not Null...However, the functions IsNumeric() and IsDate() appear to solve this issue in Access.
    If that offers any value to anyone.

  7. #7
    alansidman's Avatar
    alansidman is offline Indifferent
    Windows 7 32bit Access 2010 32bit
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,538

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

Similar Threads

  1. Please help with formula
    By JeanZander in forum Database Design
    Replies: 2
    Last Post: 01-07-2013, 04:39 PM
  2. Please help with this formula.
    By vickan240sx in forum Access
    Replies: 3
    Last Post: 09-17-2012, 03:44 PM
  3. Formula mod help
    By jcaptchaos2 in forum Access
    Replies: 2
    Last Post: 04-25-2011, 02:55 PM
  4. SQL Formula to Sum Itself
    By Scorpio11 in forum Access
    Replies: 1
    Last Post: 02-19-2011, 11:22 AM
  5. Formula
    By hschrunk in forum Access
    Replies: 3
    Last Post: 05-18-2010, 01:40 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