学校毕业日期 - 取决于日期之间的年龄 [英] School Leaving Date - depending on age between dates

查看:90
本文介绍了学校毕业日期 - 取决于日期之间的年龄的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个访问数据库(MS Access 2002),它存储学生的信息,而且我对VBA的知识非常有限。希望有人可以帮我解决这个问题。


我有一个名为frmPupils的表格,其中包含出生日期(字段名称 - DOB)。


我想在表单中添加一个文本框,该表单将显示学生的日期

可以离开学校,这取决于在DOB字段中输入的内容。


一年中有两个可能的离校日期。

5月31日和12月31日。


如果学生的16岁生日是在3月1日或9月30日之间,那么他们可以在当年5月31日离开学校。


如果学生的16岁生日是在10月1日或2月底之间,那么,如果是闰年,则需要28美元或29美元!

然后他们可以12月31日离开学校。


例如。如果DOB = 1992年8月16日,他们的16岁生日是在2008年8月,

(在3月1日至9月30日期间),

所以他们可以在31日离开学校2008年5月。


如果DOB = 1993年2月16日,他们的16岁生日将在2009年2月,

(在10月1日到2月底之间) ),

所以他们可以在2008年12月31日离开学校。



任何帮助都会非常感激。

I have an access database (MS Access 2002,) which stores school pupils information and I have very limited knowledge on VBA. Hopefully someone can help solve this one for me.


I have a form named frmPupils which contains the Date of Birth (field name - DOB).

I want to add a textbox to the form which will display a date that the pupil is
elegible to leave school, which is dependant on what is entered in the DOB field.


There are two possible school leaving dates in the year.
31st May and 31st December.

If a pupil''s 16th birthday is on or between 1st March and 30th September
they can leave school on 31st May of that year.

If a pupil''s 16th birthday is on or between 1st October until end of February,
28th or 29th if it''s a leap year!
Then they can leave school on 31st December.

eg. If DOB = 16th August 1992, their 16th birthday is in August 2008,
(within the period between 1st March to 30th September),
so they can leave school on 31st May 2008.

If DOB = 16th February 1993, their 16th birthday will be in February 2009,
(within the period between 1st October to end of February),
so they can leave school on 31st December 2008.


Any help would be much appreciated.

推荐答案

只是订阅,我会稍后再回来看看我能想出什么。
Just subscribing, I''ll return later and see what I can come up with.


这是一般的想法,假设你有一个文本在窗体上名为txtEligibleToLeave的框:
Here is the general idea, assuming youo have a Text Box named txtEligibleToLeave on the Form:
展开 | 选择 | Wrap | 行号


感谢您的输入和快速回复。


我需要它能够显示离开日期,无论他们目前的年龄。


因此,即使他们的DOB是2000年2月10日(目前年龄为8岁),我希望它在未来几年显示他们预期的离开日期,当他们在提到的日期之间达到16时,如果这是有道理的。


DOB = 2000年2月10日

预计截止日期显示为 - 2015年12月31日





DOB = 2002年9月7日

预计出发日期显示为 - 2018年5月31日


希望你能再次帮助。提前致谢
Thank you for your input and quick response.

I need it to be able to show leaving dates no matter what age they are at present.

So even if their DOB is 10th February 2000 (currently aged 8), I want it to show their expected leaving date in years to come when they do reach 16 between the dates mentioned, if that makes sense.

DOB = 10th February 2000
Expected Leaving Date to show as - 31st December 2015

or

DOB = 7th September 2002
Expected Leaving Date to show as - 31st May 2018

Hope you can help again. Thanks in advance


这篇关于学校毕业日期 - 取决于日期之间的年龄的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆