在范围内的年龄问题 [英] Trouble with age in ranges

查看:71
本文介绍了在范围内的年龄问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的查询产生正确信息时遇到问题。我需要将年龄映射到正确的范围。我正在获取重复信息,并不是所有年龄都映射到任何范围!有人可以帮忙吗?


我的年龄字段计算如下:

年龄:(#10/01/2007# - [DOB] /365.25


我的范围字段计算如下所示:

AgeRange:Switch([Age]> = 18和[Age]< 64," 18 to 64,[年龄]> = 65并且[年龄]< 69,65到69,[年龄]> = 70并且[年龄]< 100,70到100)

I am having problems with my query producing the correct information. I need the ages mapped into the correct ranges. I am getting duplicating information and not all ages are mapped to any range at all! Can someone please help?

My age field calculation looks like this:
Age: (#10/01/2007# - [DOB]/365.25

My range field calculation look like this:
AgeRange: Switch ([Age] >= 18 And [Age] < 64, "18 to 64", [Age] >= 65 And [Age] < 69, "65 to 69", [Age] >= 70 And [Age] < 100, "70 to 100")

推荐答案

我的代码中注意到了一些事项。首先,您需要在进行年度划分之前将日期更改为整数...

There are a couple of things I notice with your code. First of all you need to change the Date into an Integer before doing your year division...

展开 | 选择 | Wrap | 行号



有我注意到你的代码中的一些事情。首先,您需要在进行年度划分之前将日期更改为整数...

There are a couple of things I notice with your code. First of all you need to change the Date into an Integer before doing your year division...

< span class =codeLinkonclick =Blur(this,this.parentNode.parentNode,getChildren(this),true);>展开 | 选择 | Wrap | 行号


您是在一次查询中完成所有这些吗?


我在测试数据库中使用两个查询尽可能地重新创建,第一个计算Age,第二个包括第一个如你所知,计算AgeRange。它正确识别了我输入的每个测试值。


我设置为日期/时间数据类型的DOB字段。


发生了一个有趣的错误我正在玩这个:1918年之前的一个DOB产生了#Error的结果。仍然不确定为什么,但我正在做更多的测试:-)


问候,

Scott
Are you doing all this in one query?

I recreated as closely as I could in my test database using two queries, the first to calculate the Age, the second including the first exactly as you have it, to calculate the AgeRange. It correctly identified each test value I entered.

The DOB field I set as Date/Time data type.

An interesting error occurred while I was playing with this: a DOB before 1918 produced a result of #Error. Still not sure why yet, but I''m doing a little more testing on that :-)

Regards,
Scott


这篇关于在范围内的年龄问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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