Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / General 2 / February 2008

Tip: Looking for answers? Try searching our database.

DAvg function w/ date criteria ?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Korski - 21 Feb 2008 01:08 GMT
I'm currently attempting to use the "DAvg" function to report an average for
a given month of the current year.
 A little background:  The form I'm building looks similar to a calendar
with text boxes under each month's name label.  I would like each text box to
calculate the average post-oven density(TotalPOD) for each given month of the
year.  I'm stuck at the criteria part of the expression.  What do I put in
the criteria to tell it to average all the [TotalPOD]'s with a [DateMolded]
for only January of the current year ?
     
My current expression looks like this,
      Where [TotalPOD] is a calculated total for each test that comes from
Qryblockdenandflex and has a corrresponding [DateMolded] for each.

=DAvg("[TotalPOD]","Qryblockdenandflex","[DateMolded] {for the month of
January of the current year} ")

.....but of course the criteria part is not all there,        
               Any suggestions would be greatly appreciated as my aspirin
bottle is running low.  
                     Thanks,     Adam
John W. Vinson - 21 Feb 2008 03:13 GMT
>I'm currently attempting to use the "DAvg" function to report an average for
>a given month of the current year.
[quoted text clipped - 16 lines]
>bottle is running low.  
>                      Thanks,     Adam

You can use the DateSerial() function to generate a range of dates:

=DAvg("[TotalPOD]","Qryblockdenandflex","[DateMolded] >= #" &
DateSerial(Year(Date()), 1, 1) & "# AND [DateMolded] < #" &
DateSerial(Year(Date()), 2, 1) & "#")

The second argument of DateSerial is the month, so 1 for January, 2 for
February, 12 for December.
Signature

            John W. Vinson [MVP]

Korski - 21 Feb 2008 22:50 GMT
Thank You So Much !

            Thanks John,  I never would have figured that out......(no more
aspirin needed)      

                    Thanks again,   Adam

> >I'm currently attempting to use the "DAvg" function to report an average for
> >a given month of the current year.
[quoted text clipped - 25 lines]
> The second argument of DateSerial is the month, so 1 for January, 2 for
> February, 12 for December.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.