Search code examples
ms-accessdatabase-designms-access-2010ms-access-2013ms-access-2016

MS Access-Using value from a form in a calculated field of a table


I have a text box in a form which accepts a date. I have to use that date in the calculated expression in a field of a table. Initially I have tried to use this statement in the calculated expression.

[Forms]![Input data form]![Text38]

But it shows that "The expression cannot be used because refers to another table".

How to access the value of the text box?


Solution

  • I think I understand your question. You have a table and you want to use a calculated field in it that references a value in a form.

    You will not be able to do it that way. The reason you are getting an error is because the form data only exists when the form is running. If you used that expression in the record source query of the form, you would be ok.

    You have a couple of choices depending on what you are trying to do with the data. If you REALLY NEED a calculated field in your table, you can use a form to make an UPDATE to another field in your table; then it is static data and your calculated control can work.

    Another option is to have a separate table to store the user input value, then use a VIEW (QUERY in Access terminology) to join the data together and compute the result. Depending on why you are doing it, this is typically the method you want to go with.

    If this does not answer your question and you have something more specific, I will try to tailor the answer more.