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 / Queries / May 2008

Tip: Looking for answers? Try searching our database.

Current month IIf statement.

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Pjdelchi - 29 May 2008 16:23 GMT
I am trying to run an IIf statement that will return a value of "Y" or "N"
for any records where the [settle-dt] occurs within the current month.    I
found how to automate the results from the beginning of the month, but is
there a way to automate the statement below so that I will not have to
manually change the #6/1/2008# portion.   In other words, how can I run this
query from this point onwithout having to bother with changing of the dates
in the future?   All I need to know is what records have a [settle-dt] in the
current month.   Thanks.

"Current Month?: IIf([settle-dt]>Date()-Day(Date()) And
[settle-dt]<#6/1/2008#,"Y","N")"
Jerry Whittle - 29 May 2008 17:21 GMT
Current Month?: IIf(Month([settle-dt])=Month(Date()),"Y","N")
Signature

Jerry Whittle, Microsoft Access MVP
Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder.

> I am trying to run an IIf statement that will return a value of "Y" or "N"
> for any records where the [settle-dt] occurs within the current month.    I
[quoted text clipped - 7 lines]
> "Current Month?: IIf([settle-dt]>Date()-Day(Date()) And
> [settle-dt]<#6/1/2008#,"Y","N")"
Michel Walsh - 29 May 2008 19:17 GMT
DateSerial( Year(now), Month(now)+1, 1)

returns the first of the next month.

Vanderghast, Access MVP

>I am trying to run an IIf statement that will return a value of "Y" or "N"
> for any records where the [settle-dt] occurs within the current month.
[quoted text clipped - 11 lines]
> "Current Month?: IIf([settle-dt]>Date()-Day(Date()) And
> [settle-dt]<#6/1/2008#,"Y","N")"
John Spencer - 30 May 2008 00:25 GMT
Here are two methods.

CurrentMonth: IIF(Format(Format(Date(),"yyyymm") =
Format([Settle-dt],"yyyymm"),"Yes","No")

Or

CurrentMonth: IIF([Settle-dt] Between
DateSerial(Year(Date()0,Month(Date()),1) and
DateSerial(Year(Date()),Month(Date())+1,0),"Yes","No")

'====================================================
 John Spencer
 Access MVP 2002-2005, 2007-2008
 Center for Health Program Development and Management
 University of Maryland Baltimore County
'====================================================

> I am trying to run an IIf statement that will return a value of "Y" or "N"
> for any records where the [settle-dt] occurs within the current month.    I
[quoted text clipped - 7 lines]
> "Current Month?: IIf([settle-dt]>Date()-Day(Date()) And
> [settle-dt]<#6/1/2008#,"Y","N")"
 
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.