Results 1 to 3 of 3
  1. #1
    Kunuk is offline Novice
    Windows Vista Access 2003
    Join Date
    Feb 2009
    Posts
    2

    Calculation on form and updating results in table

    Hi, I’m new to Ms Access but I managed to create a database. I have created a table with the following fields
    ANIMALSALESID-AutoNumber
    CUSTOMERBUYING THE ANIMAL- LookUp created to link to the field name Customer Name from the Customer table
    ANIMALNAME-LookUp created to link to the firld name Animal Name from the Animal table
    DATEORDERED- Date/Time
    NUMBERANIMALORDERED-Number


    UNITPRICE-Look Up to look for the fieldname Unit Price from the Table Animal
    TOTALPRICEFORANIMAL-Number

    Then I have created an AutoForm name as FRMSALES from this table. I have put the TOTALPRICEFORANIMAL in the form Footer.

    My questions are:

    1. On the form Sales how can I make the Unit Price appear automatically when the Animal name is selected from the list?
    2. On the form Sales, how can I calculate the Unit Price being displayed automatically * the NumberofAnimalOrdered field (number which is entered in the textbox must be multiplied by the unit price of the animal)
    3. When the totalPrice is calculated, how can Access writes and updates the same answer in the Sales table, particularly in the TotalsSales column?


    I have explained it in detail as I am unable to upload the file. Please help and give suggestions.
    Thanking you all in anticipation.
    \God bless

  2. #2
    Evilferret is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2012
    Posts
    27
    There's probably better way to do this, but...

    1 - Add an After Update event to the list. Have the After Update event query the table based upon the Animal Name you selected, and return the appropriate UnitPrice. Set the value of the UnitPrice box equal to the result of the query.

    2 - Modify your After Update event on the list to have it do this. Essentially the same thing as in 1, only your query will be NumberofAnimalOrdered * UnitPrice.

    3 - Create a button with an OnClick event that retrieves the value from each textbox in VBA code, then writes those values into the Sales table using a SQL statement.

  3. #3
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Since you are new to MS Access you should read this: http://access.mvps.org/access/lookupfields.htm

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

Similar Threads

  1. updating table using results of another query
    By AdrianoG87 in forum Queries
    Replies: 1
    Last Post: 11-23-2011, 11:24 PM
  2. Form not Updating Table
    By j2curtis64 in forum Forms
    Replies: 1
    Last Post: 05-11-2011, 05:17 PM
  3. updating a table from a form.....
    By softspoken in forum Access
    Replies: 7
    Last Post: 04-21-2010, 09:04 AM
  4. Updating a table from a form
    By Lynn in forum Forms
    Replies: 3
    Last Post: 03-18-2010, 10:51 AM
  5. Replies: 0
    Last Post: 02-24-2010, 12:56 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