Results 1 to 4 of 4
  1. #1
    2 Star Lounger
    Join Date
    Aug 2001
    Posts
    116
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Writing the value of calculated control to (2000)

    I'm trying to write the value of a calculated control to another control in the form and thus back to the table.
    The Value (Estimated Cost) is determined as the result of a series of calculated controls.
    I've tried using a SetValue Macro and tried to set the value via VBA. Failure on all counts. What really irks me is the sensation I'm missing something obvious.
    So if you have any suggestions about obvious errors, please pass them on.

    TIA

  2. #2
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Writing the value of calculated control to (2000)

    Well, the most obvious thing is that you don't normally store calculated values, assuming you can recalculate them on the fly. In cases where a value is based on current rates and those rates may change over time, then you do, in fact, need to store a calculated value. If the control has the calculated total, all you should need is a line of code to say Me!<DestinationControl> = Me!<CalculatedControl>. The gotchas are that the destination control has to be bound to a field in a table and the when and where of trying to set the value. More details would help.
    Charlotte

  3. #3
    2 Star Lounger
    Join Date
    Aug 2001
    Posts
    116
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Writing the value of calculated control to (2000)

    I know that normally, one wouldn't save a calculated control - but there are two things I'm thinking that might change this. 1) It is an estimated cost that they will perhaps want to compare with the final cost. 2) I'm going to have to do a hideously complicated (I haven't even started to worry about how) export of the data into a preset Excel form. And Estimated cost is one of the fields on the form.

    Plus it annoys me that something that should be simple is giving me this amount of grief <img src=/S/bouncenburn.gif border=0 alt=bouncenburn width=31 height=31>

  4. #4
    Super Moderator
    Join Date
    Aug 2001
    Location
    Evergreen, CO, USA
    Posts
    6,623
    Thanks
    3
    Thanked 60 Times in 60 Posts

    Re: Writing the value of calculated control to (2000)

    It shouldn't be that hard - though I would do it in VBA rather than in a macro. Your situation isn't an uncommon one, and yes, I would expect they would want to preserve the estimted cost, so you need a field in your table to store that. What process are you using to calculate the value? It would normally be some sort of entry of data into a text box I should think, so you could trigger the code from the Exit event of a text box. You would probably want to do some validity checking before doing the calculation anyhow. Hope this helps.
    Wendell

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •