Copying data from one control to another using button

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Symon
    New Member
    • Aug 2010
    • 2

    #1

    Copying data from one control to another using button

    Hi there

    I have two text boxes on a form - "autosum" and "total". The "autosum" control displays a calculation executed by the underlying query. I am wanting to either enter this value into the "total" control via a button, or manually enter a value into the "total" control. I have read somewhere that you cant override a control when the value is the result of a calculation. Please note that I am very new to access so please be explicit with any code that I need to use.

    As an aside - I tried to do this another way - I tried to set the "default value" property of the "total" control by entering:

    =[autosum]

    but this didnt work either, it resulted in a null value.

    Many thanks in advance.


    Symon
  • Delerna
    Recognized Expert Top Contributor
    • Jan 2008
    • 1134

    #2
    First off, why do you want to save a calculated field?

    It is generally not good practice to save calculated fields. This doesn't mean you mustn't but you really should have a good reason to do it.

    More questions,
    Is [autosum] the name of the field or the textbox for the calculated field.
    do you know how to write VBA code into control events?

    Comment

    • Symon
      New Member
      • Aug 2010
      • 2

      #3
      Hi Delerna

      Many thanks for your response.

      The [autosum] control on the form is bound to a calculated field in the underlying query and not from the table - so the value isnt saved into a table. I simply want a means of overriding the calculated value to allow for flexibility - which is required for this particular application. The value that is entered into [total] will be saved however as this value may be manually entered. I thought that the easiest solution to this would be to place a button next to the [autosum] control which enters this value into the [total] control. The [total] control is bound to the same field in the originating table however - this is to allow for the possibility of a manually-entered value.

      I am open to a better way to do this.

      In the past I have dealt with code by finding the required code in other access db's then modifying it to work, or using the wizard where I can.

      Thanks for your help - I hope all of this makes sense.


      Symon

      Comment

      Working...