Results 1 to 13 of 13
  1. #1
    sdc1234 is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jun 2013
    Posts
    89

    total amount

    Greetings,

    I am trying to calculate that when students are staying on campus it is mulitplied by 1200 and if they are off it is 1800 here is my query:



    Estimated Total: ([EMI_Courses_ALL]![Students Scheduled]+[EMI_Courses_ALL]![Instructors]-[EMI_Courses_ALL]![Off Campus Beds]*1200)+([EMI_Courses_ALL]![Off Campus Beds]*1800)
    what am I doing wrong...


    v/r

    novice

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,931
    Sounds like you need an IIf

    What data is in [Off Campus Beds]?

    Why do you subtract * 1200 then add * 1800?
    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
    sdc1234 is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jun 2013
    Posts
    89
    the data in Off Campus beds are numbers 1,3,5,12, the reason for the subtraction is the fact that they are not off campus beds and the *1800 is when they are

  4. #4
    sdc1234 is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jun 2013
    Posts
    89
    I am basically trying to * 1800 by the cells that have off campus beds on them, and the rest by 1200 if there is no data in the field

  5. #5
    sdc1234 is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jun 2013
    Posts
    89
    I got it, had the parathesis in the wrong place, thanks

  6. #6
    sdc1234 is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jun 2013
    Posts
    89
    Quick ?, I have some of my off campus beds as blanks, I know I need to write an iff, then statement to make the data from my total cost come over, can you provide me with an example and let me know weather or not it should go before the rest of the script?

    v/r
    novice

  7. #7
    sdc1234 is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jun 2013
    Posts
    89
    IIf(IsEmpty([test]),[Estimated Total],([EMI_Courses_ALL]![Students Scheduled]+[EMI_Courses_ALL]![Instructors]-[EMI_Courses_ALL]![Off Campus Beds])*1200+[EMI_Courses_ALL]![Off Campus Beds]*1800)

    is there something wrong with my iff statement, I want the values of the estimated cost to come over to all the blanks

  8. #8
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,931
    Are the 'blanks' empty string or Null? Makes a difference. What is [test]?

    Arithmetic with Null results in Null. Arithmetic with empty string will error.

    I still don't understand the expression.
    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.

  9. #9
    sdc1234 is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jun 2013
    Posts
    89
    I do have blank cells, here is what I am working with now, it somewhat works although it is changing the value with the off campus beds
    test: IIf("*",[Estimated Total],([EMI_Courses_ALL]![Students Scheduled]+[EMI_Courses_ALL]![Instructors]-[EMI_Courses_ALL]![Off Campus Beds])*1200+[EMI_Courses_ALL]![Off Campus Beds]*1800)
    I am just trying to bring the values in estimated total over to the empty cells

  10. #10
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,931
    None of that makes sense to me.

    Maybe you better provide db.

    Identify the form involved.
    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.

  11. #11
    sdc1234 is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jun 2013
    Posts
    89
    Expr1: IIf([EMI_Courses_ALL]![Location]="CANCELLED" Or [EMI_Courses_ALL]![Location]="MOVED",IIf([EMI_Courses_ALL]![Off Campus Beds]="",IIf([EMI_Courses_ALL]![Type]="E",1200,1800)*([EMI_Courses_ALL]![Students Scheduled]+[EMI_Courses_ALL]![Instructors]),([EMI_Courses_ALL]![Students Scheduled]+[EMI_Courses_ALL]![Instructors]-[EMI_Courses_ALL]![Off Campus Beds])*1200+[EMI_Courses_ALL]![Off Campus Beds]*1800),0)

    this is the script I have written, I am just trying to make all the values of the CANCELLED or MOVED classes to =0 but when I run the query, everything changes to 0, is there something in this script I am leaving out?

  12. #12
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,931
    Build the expression in stages.

    Start with:

    IIf(Location="CANCELLED" Or Location="MOVED", 0, 1)

    Now in place of 1 do the nested IIfs. Build them in stages as well.

    Off Campus Beds will have empty string in field? More likely field without data will be Null. I don't allow empty string in tables just so I can be certain of Null.
    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.

  13. #13
    sdc1234 is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jun 2013
    Posts
    89
    thanks it worked much appreciated

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

Similar Threads

  1. splitting an amount
    By mohiahmed in forum Access
    Replies: 1
    Last Post: 07-15-2013, 04:39 PM
  2. Calculation of amount boxes
    By visidro in forum Access
    Replies: 4
    Last Post: 03-16-2013, 02:05 PM
  3. Replies: 3
    Last Post: 01-31-2013, 06:29 PM
  4. limiting amount of records
    By yaro.kobzar in forum Programming
    Replies: 1
    Last Post: 05-17-2011, 07:01 PM
  5. Replies: 2
    Last Post: 10-25-2010, 10:45 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