A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

date query in the sub-report



 
 
Thread Tools Display Modes
  #1  
Old April 14th, 2009, 06:32 AM posted to microsoft.public.access.queries
associates
external usenet poster
 
Posts: 132
Default date query in the sub-report

Hi,

I was wondering if i could get some help with SQL query. I have a report and
a sub-report. They both are linked by studentID field. My question is if i
want to perform a query to retrieve all records associated with that
studentID but with the month less than the current month. For example, in
master report (Departments Report), it uses a Departments table and in the
sub-report, it uses Students table. In the Students table, there is a field
called Entry Date with the following format: dd/mm/yyyy.

So if the current month is March or 03, the sub-report will show all the
student details with their entry date less than this month. I know that i
need to use something like Date(month) or something, so that it knows that
this month is March, it needs to output all records before March. How do i do
this in the sub-report (e.g. myStudents-SubReport). But how do i put in the
date(month) thing in the sub-report?

Any helps would be greatly appreciated.

Thank you in advance


  #2  
Old April 14th, 2009, 10:09 AM posted to microsoft.public.access.queries
raskew via AccessMonster.com
external usenet poster
 
Posts: 370
Default date query in the sub-report

This will return the first day of the current month:
DateSerial(year(Date()), month(Date()), 1)
...so, in the criteria cell of your date field:
DateSerial(year(Date()), month(Date()), 1)

HTH - Bob

Associates wrote:
Hi,

I was wondering if i could get some help with SQL query. I have a report and
a sub-report. They both are linked by studentID field. My question is if i
want to perform a query to retrieve all records associated with that
studentID but with the month less than the current month. For example, in
master report (Departments Report), it uses a Departments table and in the
sub-report, it uses Students table. In the Students table, there is a field
called Entry Date with the following format: dd/mm/yyyy.

So if the current month is March or 03, the sub-report will show all the
student details with their entry date less than this month. I know that i
need to use something like Date(month) or something, so that it knows that
this month is March, it needs to output all records before March. How do i do
this in the sub-report (e.g. myStudents-SubReport). But how do i put in the
date(month) thing in the sub-report?

Any helps would be greatly appreciated.

Thank you in advance


--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...eries/200904/1

  #3  
Old April 15th, 2009, 02:41 AM posted to microsoft.public.access.queries
associates
external usenet poster
 
Posts: 132
Default date query in the sub-report

It works really well, Bob.

Thank you

"raskew via AccessMonster.com" wrote:

This will return the first day of the current month:
DateSerial(year(Date()), month(Date()), 1)
...so, in the criteria cell of your date field:
DateSerial(year(Date()), month(Date()), 1)

HTH - Bob

Associates wrote:
Hi,

I was wondering if i could get some help with SQL query. I have a report and
a sub-report. They both are linked by studentID field. My question is if i
want to perform a query to retrieve all records associated with that
studentID but with the month less than the current month. For example, in
master report (Departments Report), it uses a Departments table and in the
sub-report, it uses Students table. In the Students table, there is a field
called Entry Date with the following format: dd/mm/yyyy.

So if the current month is March or 03, the sub-report will show all the
student details with their entry date less than this month. I know that i
need to use something like Date(month) or something, so that it knows that
this month is March, it needs to output all records before March. How do i do
this in the sub-report (e.g. myStudents-SubReport). But how do i put in the
date(month) thing in the sub-report?

Any helps would be greatly appreciated.

Thank you in advance


--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...eries/200904/1


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 07:51 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.