Results 1 to 4 of 4
  1. #1
    Nokia N93 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Nov 2010
    Posts
    55

    Cool Help with small form calculations

    hello everyone, can you help me ?


    i have the following , which i want a help in

    Below is what I am trying to accomplish:
    1- i need to enter the prices of the goods, let us say 3 products then i want to sum the values and store it in the required field,, i did this by doing a query to sum the fields , but the result was in the feild but it wasn't save in the table

    2- if the summation was :
    less than 1000 $ , i want the sum to be multiplied by 5%
    between 1000 and 2000 , multiply the sum with 7%
    if it is larger than 2000, multiply the result with 10%

    i tried to do this, but i couldn't figure out how to do the if - else
    Thanks for any help or feedback

  2. #2
    alansidman's Avatar
    alansidman is offline Indifferent
    Windows 7 32bit Access 2007
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,536
    There is no reason to store calculated data in a table in a relational database. You do your calculations in queries and forms and generate reports as necessary. Tables are for storing raw data. It may look like a spreadsheet but it is not and therefore should not be confused with a spreadsheet. If you start to store calculations in a table and conditions or criteria change, then you have to go back into the table and make the updated changes. This is not how you want to be handling data in a data base.

    http://www.fontstuff.com/access/acctut02.htm

    Here is your expression for your if statement:

    =IIF([yourfield]<1000,[yourfield]*.05, IIF([yourfield]>1000 and [yourfield]<2000,[yourfield]*.07,[yourfield]*.1))

    Alan

  3. #3
    imintrouble is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Sep 2011
    Location
    Missouri, where frownin's a sport
    Posts
    127
    I had only just finished working out the code when i refreshed the page and saw that Alan had already answered you, but I didn't do that work for nothing!

    What I came up with was using ElseIf statements in a module which is then called up in the design mode of the query which is then used to create the field for the summation and the multiplied answer afterwards. therefore, this is the code that I have come up with,

    Code:
     
    
    Dim multiAnswer As Integer
    If (summation < 1000) Then
    multiAnswer = summation * 0.05
    ElseIf ((summation > 1000) And (summation < 2000)) Then
    multiAnswer = summation * 0.07
    Else
    multiAnswer = summation * 0.1
    End If
    multAnswer = multiAnswer

  4. #4
    Nokia N93 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Nov 2010
    Posts
    55
    Alan and imintrouble thanx alot for the help

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

Similar Threads

  1. Replies: 2
    Last Post: 07-21-2011, 08:57 AM
  2. open small popup form by press functional key
    By alex_raju in forum Access
    Replies: 0
    Last Post: 07-13-2011, 09:20 AM
  3. Form Opening as small window
    By ETCallHome in forum Forms
    Replies: 1
    Last Post: 06-14-2011, 08:16 AM
  4. Calculations in a form
    By elmere in forum Forms
    Replies: 3
    Last Post: 04-27-2011, 04:11 PM
  5. Replies: 1
    Last Post: 07-14-2010, 11:55 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