查询月份 [英] Query for Month

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

问题描述

我在运行XP的计算机上使用Access 2003。我是

的新用户。我有一个日期字段存储为mm / dd / yyyy的Db。我需要一个会提示月份的查询,即。 6月6日,并将

返回该月的所有记录。

I am working with Access 2003 on a computer running XP. I am new at
using Access. I have a Db with a date field stored as mm/dd/yyyy. I
need a Query that will prompt for the month, ie. 6 for June, and will
return all records in that month.

推荐答案

Stan写道:
Stan wrote:

我在运行XP的计算机上使用Access 2003。我是

的新用户。我有一个日期字段存储为mm / dd / yyyy的Db。我需要一个会提示月份的查询,即。 6月6日,并将

返回该月的所有记录。
I am working with Access 2003 on a computer running XP. I am new at
using Access. I have a Db with a date field stored as mm/dd/yyyy. I
need a Query that will prompt for the month, ie. 6 for June, and will
return all records in that month.



假设您想要的年份始终是当前年份,请使用以下标准:

Assuming the year you want is always the current year, use a criteria of...


> = DateSerial(年份(日期(),[输入月份数],1)
>=DateSerial(Year(Date(), [Enter Month Number], 1)



AND< DateSerial(年(日期(),[输入月份数] ] +1,1)


-

Rick Brandt,Microsoft Access MVP

电子邮件(视情况而定)给.. 。

来自Hunter dot的RBrandt

AND <DateSerial(Year(Date(), [Enter Month Number]+1, 1)

--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com


2006年12月23日11:02:11 -0800,Stan写道:
On 23 Dec 2006 11:02:11 -0800, Stan wrote:

我在运行XP的计算机上使用Access 2003.我是新用的

使用Access。我有一个日期字段存储为mm / dd的Db / yyyy。我

需要一个提示月份的查询,即6月份的6,并且

将返回当月的所有记录。
I am working with Access 2003 on a computer running XP. I am new at
using Access. I have a Db with a date field stored as mm/dd/yyyy. I
need a Query that will prompt for the month, ie. 6 for June, and will
return all records in that month.



为了帮助您了解访问日期,日期不会存储在任何

特定的格式中。

日期存储为1899年12月30日以来的天数。

今天的日期存储为39074.

您可以输入日期价值截至2006年12月23日,12-23-2006,

12/23 / 2006,23 / 12/2006,以及2006年12月23日等,Access将

商店39074.


返回任何特定月份和年份记录的一种方法:


格式([DateField] ,mm / yyyy)= [输入月/年]


-

Fred

请仅回复这个新闻组。

我不回复个人电子邮件

Just to help you understand Access dates, dates are not stored in any
particular "Format".
Dates are stored as the number of days since 12/30/1899.
Today''s date is stored as 39074.
You can enter a date value as December 23, 2006, 12-23-2006,
12/23/2006, 23/12/2006, as well as 23 Dec. 2006, etc., and Access will
store 39074.

One way to return records for any particular month and year:

Where Format([DateField],"mm/yyyy") = [Enter Month/Year]

--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail


我决定关注Freds线程,因为它看起来最简单。我必须

学习更多关于构建表达式的内容。


弗雷德,

首先我假设我在中输入表达式标准行

我的日期字段。


我输入表达式:


格式([DateField], mm / yyyy= [输入月份/年份]


运行时,系统会提示我输入DateField参数值

我应该输入字段名称吗? ??

确定我被提示输入月/年参数值

我输入02/2004

确定我提示月。


我输入02


确定没有记录被退回。


你能来吗?发现我做错了什么?


感谢大家,


Stan Hanna

fredg写道:
I decided to follow Freds thread since it looks the simplest. I must
learn a great more about building expressions.

Fred,
First I an assuming I type the expression in the Criteria line under
my date field.

I enter the expression:

Format([DateField],"mm/yyyy") = [Enter Month/Year]

On RUN I am prompted for the DateField Parameter Value
Should I enter the Field Name ??
On OK I am prompted for the Month/Year Parameter Value
I enter 02/2004
On OK I am Prompted for the Month.

I enter 02

On OK no records are returned.

Can you spot what I am doing wrong ?

Thanks to you all,

Stan Hanna
fredg wrote:

2006年12月23日11:02:11 -0800,Stan写道:
On 23 Dec 2006 11:02:11 -0800, Stan wrote:

我正在使用在运行XP的计算机上访问2003。我是

的新用户。我有一个日期字段存储为mm / dd / yyyy的Db。我需要一个会提示月份的查询,即。 6月6日,并将

返回该月的所有记录。
I am working with Access 2003 on a computer running XP. I am new at
using Access. I have a Db with a date field stored as mm/dd/yyyy. I
need a Query that will prompt for the month, ie. 6 for June, and will
return all records in that month.



只是为了帮助您了解访问日期,日期不会存储在任何

特定的格式中。

日期存储为1899年12月30日以来的天数。

今天的日期存储为39074.

您可以输入日期值2006年12月23日,2006年12月23日,

12/23 / 2006,23 / 12/2006,以及2006年12月23日等,Access将

store 39074.


返回任何特定月份和年份记录的一种方法:


格式([DateField], ; mm / yyyy")= [输入月/年]


-

Fred

请仅回复此新闻组。

我不回复个人电子邮件


Just to help you understand Access dates, dates are not stored in any
particular "Format".
Dates are stored as the number of days since 12/30/1899.
Today''s date is stored as 39074.
You can enter a date value as December 23, 2006, 12-23-2006,
12/23/2006, 23/12/2006, as well as 23 Dec. 2006, etc., and Access will
store 39074.

One way to return records for any particular month and year:

Where Format([DateField],"mm/yyyy") = [Enter Month/Year]

--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail


这篇关于查询月份的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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