Results 1 to 8 of 8
  1. #1
    markpastoril is offline Advanced Beginner
    Windows 10 Access 2013 64bit
    Join Date
    Aug 2018
    Posts
    62

    what's wrong with this one?

    cant figure out what was wrong with this expression, some takes effect and some are not.WHY?


    please need some help
    This is from my query field.

    DISCOUNT5%: IIf([m3]<="30" And [SCDiscount_Status]="2",[AMOUNTDUE]*0.05,0)

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,815
    If field is number type, don't put parameters within quote marks.

    Advise not to use special characters in field names. Better would be Discount5Pct.
    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
    markpastoril is offline Advanced Beginner
    Windows 10 Access 2013 64bit
    Join Date
    Aug 2018
    Posts
    62
    thanks sir it works..

  4. #4
    markpastoril is offline Advanced Beginner
    Windows 10 Access 2013 64bit
    Join Date
    Aug 2018
    Posts
    62
    I'm using this code :
    SCDiscount: IIf(Nz([m3])<=30,IIf(Nz([SCDiscount_Status])=2,[AMOUNTDUE]*0.05,0))

    but this is what happens.

    Click image for larger version. 

Name:	query.jpg 
Views:	16 
Size:	199.0 KB 
ID:	39064

  5. #5
    Join Date
    Apr 2017
    Posts
    1,673
    Code:
    IIf(
         Nz([m3],0)<=30,
         IIf(Nz([SCDiscount_Status],0)=2, [AMOUNTDUE]*0.05,0)
         What must be returned, when Nz([m3])>30?
    )

  6. #6
    markpastoril is offline Advanced Beginner
    Windows 10 Access 2013 64bit
    Join Date
    Aug 2018
    Posts
    62
    it will return 0,

  7. #7
    Join Date
    Apr 2017
    Posts
    1,673
    Then
    Code:
    IIf(Nz([m3],0)<=30, IIf(Nz([SCDiscount_Status],0)=2, [AMOUNTDUE]*0.05,0),0)
    Or
    Code:
    IIf(Nz([m3],0)<=30 AND Nz([SCDiscount_Status],0)=2, [AMOUNTDUE]*0.05,0)

  8. #8
    markpastoril is offline Advanced Beginner
    Windows 10 Access 2013 64bit
    Join Date
    Aug 2018
    Posts
    62
    Thanks sir it works

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

Similar Threads

  1. I KNOW I am doing it wrong
    By lonesoac0 in forum Macros
    Replies: 2
    Last Post: 12-17-2016, 06:32 PM
  2. what is wrong ?
    By dino in forum Access
    Replies: 19
    Last Post: 07-29-2015, 11:13 AM
  3. What am I doing wrong?
    By Access_noob_ in forum Programming
    Replies: 3
    Last Post: 11-03-2014, 10:47 AM
  4. What's wrong!
    By khalid in forum Programming
    Replies: 15
    Last Post: 06-27-2011, 06:38 AM
  5. What is wrong with this IFF?
    By bburton in forum Reports
    Replies: 2
    Last Post: 03-16-2011, 10:42 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