Results 1 to 7 of 7
  1. #1
    Join Date
    Aug 2004
    Posts
    48

    Unanswered: Access database/Storing a displayed value

    I need to store a value in a table that is the result of an expression or calculation in another field. Is there a way to copy or transfer a displayed value from one field into another field that will store that value in the table?

  2. #2
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    Make very sure there is a reason to. Storing formula calculations is often pointless and more problematic that it is worth.

    Can you explain why you need to do it and not just recalculate the figure whenever it is needed?
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  3. #3
    Join Date
    Feb 2004
    Location
    New Zealand
    Posts
    1,424
    Provided Answers: 8
    way store the value twice

    you can create function to cal out the answer in the new feild

    ie I have a weekend function

    when I want to know the weekend of a date I just call that the weekend function and put the date value in there and has the answer.
    hope this help

    See clear as mud


    StePhan McKillen
    the aim is store once, not store multiple times
    Remember... Optimize 'til you die!
    Progaming environment:
    Access based on my own environment: DAO3.6/A97/A2000/A2003/A2007/A2010
    VB based on my own environment: vb6 sp5
    ASP based on my own environment: 5.6
    VB-NET based on my own environment started 2007
    SQL-2005 based on my own environment started 2008
    MYLE
    YOUR PASSWORD IS JUST LIKE YOUR TOOTHBRUSH DON'T SHARE IT.

  4. #4
    Join Date
    Aug 2004
    Posts
    48

    Access/Storing displayed values

    Reply to StarTrekker:


    I'll try to explain this as briefly as I can.

    This a database that, among other things, tracks children participating in a social service program. The children's birth dates are stored when those dates are known. Sometimes a staff member only has the age of the child and needs to estimate what the birth date might be.

    On the Child Intake form, I created a pop up form that opens when staff clicks on a command button called "Estimated DOB Calculator." There are 3 fields on this form one of which is hidden.

    1. Start Date (This is the hidden field and defaults to today's date)
    2. Staff enters the age in a field called "Child Age" (Referred to as "Text0" in the expression in #3.)
    3. "FutureDate" is a field containing this expression (=DateSerial(Year([StartDate])-[Text0],Month([StartDate]),Day([StartDate])) This gives them the approximate DOB of the child.

    Staff takes the results from field #3 and types it into a field on the intake form called "EstimatedDOB." Those are the values that are stored in the table. (Staff could do this in their heads but that's another story...)

    I'm trying to figure out how to this calculation on the Child Intake form rather than the pop up and have the results from "FutureDate" transferred to the "EstimatedDOB" field in some way other than by having staff type it in.

  5. #5
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    Good reason!

    From your popup form, you could create a button that pokes the DOB into the Child Intake form with the code:

    Forms("Child Intake")![EstimatedDOB] = Me.[FutureDateControl]

    Is that what you are after?
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  6. #6
    Join Date
    Aug 2004
    Posts
    48

    Access/Storing displayed values

    Perfect StarTrekker!!!

    Thanks so much. I was trying something like that but didn't get it quite right.

  7. #7
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    No problem; happy to help
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

Posting Permissions

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