问题描述
首先让我说两件事 - 我一直在寻找和尝试两天不同的例子,但是我找不到任何工作(我很肯定,因为我缺乏知识),其次,如果任何善于尝试帮助我的人都认为我不需要每一步都能让它发挥作用,他们可能是错的。我想在查询中放置一个字段,该字段将计算当前日期的年和月的年龄,以便我可以将其用于多个表单或报表。我目前使用的(如下所示)只给出了几年,现在我也想要几个月。
年龄:DateDiff(yyyy,[出厂日期] ,Now())+ Int(格式(Now()," mmdd")<格式([从工厂发货的日期],mmdd))
如果是在我的表单或报告中放置一个未绑定的控件会更容易,我也愿意这样做。任何帮助将不胜感激。
First let me say two things--I have been searching and trying different examples for two days and have not been able to make anything I find work (I''m sure due to my lack of knowledge) and second, if anyone that is kind enough to try to help me assumes I won''t need every single step included to make it work, they are probably wrong. I want to put a field in a query that will calculate age in years and months to the current date so that I can use it for more than one form or report. What I am currently using (shown below) gives only years and now I''d like months as well.
Age: DateDiff("yyyy",[Date Shipped from Factory],Now())+Int(Format(Now(),"mmdd")<Format([Date Shipped from Factory],"mmdd"))
If it would be easier to put an unbound control in my form or report, I would be willing to do that as well. Any assistance would be appreciated.
推荐答案
这篇关于在Query中计算年和月的年龄的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!