Passing Calculated Field from a Form to a Query

  • Thread starter Thread starter Bill
  • Start date Start date
B

Bill

I'm calculating the number of weeks between two dates on a
form using the datediff function "=DateDiff("ww",
[StartDate],[EndDate])", and I am displaying the correct
number of weeks on the form itself. But when I try to
place that field in a query, it shows up as an invalid
character, actually as a small square.

Can someone tell me how to get the calculated value to
appear as a legal piece of data?

Thanks.
 
Can someone tell me how to get the calculated value to
appear as a legal piece of data?

Generally, you don't. Storing it in a Table just risks data
corruption, since one of the underlying date fields can be changed,
making the result invalid.

Either recalculate it when needed, or put the calculation into the
query itself as a calculated field by typing

WeeksElapsed: DateDiff("ww", [StartDate], [EndDate])

in a vacant Field cell in your query.
 
Back
Top