Results 1 to 4 of 4
  1. #1
    chr1stoper1 is offline Advanced Beginner
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    55

    Text box calculations to save in table


    Hi Guys

    I have a database with a form which is linked to a table . On the form I have a text box which does a calculation based on figures that are input on the form.How can I get the figures that are calculated by the text box to save in the linked table?
    Help much appreciated

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,521
    You normally DONT save calculations in a table. They remain a calculation in a query.
    but you can if you want.
    the linked table must have the field. If not, you must create the field in the non linked db.

  3. #3
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    How can I get the figures that are calculated by the text box to save in the linked table?
    I imagine you already have a field in your table for this form control. However, a calculated control cannot be bound to any field so you need code or macro to update the table with the value.

    Storing calculations is not advised for most cases. See http://allenbrowne.com/casu-14.html
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  4. #4
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,016
    I won't rehash the 'don't store a calculated field' argument...that's a given.

    But if you simply have to do this...use something along the lines of

    =[ControlA] + [ControlB]

    (or whatever your calculation is) in the Control Source of the Control in question (let's call it ControlC)

    1. Delete that from the Control Source
    2. Replace it with the name of the Field in the Table that is to hold the results of the calculation
    3. In the Form_BeforeUpdate event (in the code widow) place the following code
    4. Me.ControlC = Me.ControlA + Me.ControlB

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

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

Similar Threads

  1. How to save calculations
    By bar891 in forum Programming
    Replies: 7
    Last Post: 05-08-2013, 06:32 AM
  2. Calculations in text boxes
    By Adammcclean11 in forum Access
    Replies: 1
    Last Post: 12-13-2012, 05:07 PM
  3. Replies: 1
    Last Post: 10-29-2012, 03:07 PM
  4. Replies: 2
    Last Post: 03-01-2012, 12:21 PM
  5. Replies: 9
    Last Post: 01-20-2011, 02:22 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