Results 1 to 8 of 8
  1. #1
    mooseless05 is offline Novice
    Windows XP Access 2003
    Join Date
    Nov 2010
    Posts
    4

    Problem with calculations on a Datasheet

    Hi, I have set up a new datasheet for an invoicing sytem I am currently working on - I have the following fields for four calculations I need to do



    Quantity
    UnitPrice
    NetAmount
    VATRate
    VATAmount

    TotalNetAmount
    TotalVATAmount

    The first calculation is Quantity x Unit Price

    so in the "NetAmount" text box's Control Source I entered

    =[Quantity]*[UnitPrice]

    which works fine and gives me the correct total in the "NetAmount" Box

    Then to add VAT I added the following to the "VATAmount" Text box's Control Source

    =CLng([NetAmount]*[VATRate]*100)/100

    which also works fine and gives me the correct total in the "VATAmount" Box

    Now I need to add the two seperate amounts together so I have two text boxes in the Form Footer - One called "TotalNetAmount" and the other called "TotalVATAmount"

    For the "TotalNetAmount" I added the following to the Control Source

    =Sum([Quantity]*[UnitPrice])

    Which again works correctly

    but it is with the "TotalVATAmount" I am having the problems - no matter what I try I get either an error, nothing or just 0.

    Any sugestions would be much appreciated

    Many Thanks

    James

    Windows XP
    Office 2003

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Try putting your calculations in the RecordSource instead. It is a query right?

  3. #3
    mooseless05 is offline Novice
    Windows XP Access 2003
    Join Date
    Nov 2010
    Posts
    4
    Hi,

    No it is not a query it is a standard datasheet, therefore, only control source is available.

    Thanks

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    When you say "it is a standard datasheet", are you saying the Datasheet view of a table rather than the Datasheet view of a Form? A Form in any mode has a RecordSource.

  5. #5
    mooseless05 is offline Novice
    Windows XP Access 2003
    Join Date
    Nov 2010
    Posts
    4
    Hi, it is a Datasheet view of a table - The datasheet form itself has the Record Source set as the Table of the same name.

    Is there any way that the actual table can run the caluclations, I'm not sure if this is possible?

    Basically all I need is the following fields

    Invoice ID - Qty - Details - Unit Price - Net Amount - VAT Rate - VAT Amount

    The Net Amount = Qty x Unit Price

    The VAT Amount = Net Amount x VAT Rate

    Then I need the Total of The Net Amount and the VAT Amount for all the records displayed in the invoice.

    If you have any ideas as to how else I can get this to work I would be gratefull.

    Thanks

    James

  6. #6
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    I do not know why you have a reluctance to using a query. It takes up essentially no room in the db other than a few character spaces and has a ton of power. Tables are for storing data and query are for calculations. A form cannot distinguish between a table and a query.

  7. #7
    mooseless05 is offline Novice
    Windows XP Access 2003
    Join Date
    Nov 2010
    Posts
    4
    HI, The reason that I havn't used a query is that I need to enter the data directly into the datasheet - i.e.: I manually enter the quantity, details and unit price and the calculations do the rest - I don't think that a query has that sort of capability - but I could be wrong - I don't have much experience of working with queries so It may well be possible but I'm not sure.

    Thanks

    James

  8. #8
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Look at the Datasheet view of the query. It looks the same as the table. You do not what users to be able to get to anything but forms.

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

Similar Threads

  1. Date calculations
    By NOTLguy in forum Access
    Replies: 10
    Last Post: 10-09-2010, 06:41 AM
  2. Calculations in reports
    By bvanscoy678 in forum Reports
    Replies: 4
    Last Post: 08-05-2010, 06:27 AM
  3. subform calculations
    By genesis in forum Forms
    Replies: 0
    Last Post: 12-03-2009, 07:18 PM
  4. Calculations in Access
    By dominick in forum Access
    Replies: 0
    Last Post: 07-28-2009, 07:39 AM
  5. Time calculations
    By jimandann in forum Programming
    Replies: 2
    Last Post: 02-18-2009, 12:27 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