Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2007
    Posts
    148

    Unanswered: import the value back into table from a control in the form

    I found a function (On time and how much has elapsed) from microsoft office which can calculate the elapse days and times for me. It is working!!!!

    Following the instruction from the page, I insert the following expression in the Control Source property of the text box. (The label of the text box is txtCalChangeDuration)
    =ElapsedTimeString(DateTimeStart,DateTimeEnd)

    The text box does give me the correct elapsed time from the two variables (DateTimeStart and DateTimeEnd) I provide.

    My problem is how to put this value txtCalChangeDuration into my ChangeDuration field in my main table.

    All the controls in my form so far are associate with a field in my main table. Everytime I edit the control in the form, the value in the field of my main table got update too. Since the Control Source Property of txtCalChangeDuration is an expression and not associate with the ChangeDuration field, I don't know how to record the value into the ChangeDuration field in my table.

    I tried to create another text box (testbox -- which is associate with the ChangeDuration field in my main table) and use the after event on the txtCalChangeDuration box to update the testbox value in hope that it will update the ChangeDuration field in my main table but it is not working.

    ****************************************
    Here is my code:

    Private Sub txtChangeDuration_AfterUpdate()
    testbox = Me.txtChangeDuration
    End Sub
    *****************************************

    I have also try testbox = Me.txtChangeDuraton.text and testbox=Me.txtChangeDuration.value. Both are not working.
    Thanks for your help in advance.

    Thanks

  2. #2
    Join Date
    Jan 2007
    Location
    California, USA
    Posts
    520
    Sweetmail. Unless this ChangeDuration field MUST be captured now and never again calculated, then it is best to leave the calculated data out of the table. Whenever you need this data, you can calculate it again with the function you already have. For example, you will be putting this data on a report? If so, you just print the calculated value from DateTimeStart and DateTimeEnd. If you would like to read up on data normalization, which NOT storing calculated values is a part of, then follow the link in my signature block about Access Design Tips. Read the first article referenced on that web page. It is excellent! (I did not write it, so I can say it is excellent!)

  3. #3
    Join Date
    Sep 2007
    Posts
    148
    Thank you Vic.

    I will read the article.

Posting Permissions

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