Current month in the criteria of a query

C

ChuckW

Hi,
I research this one but could not find an answer. I have a field called
FiscalMonth that has the name of the month (ie February, March) as values. I
want to run a query that captures the current month using this field. What
would I put in the criteria expression to capture this?

Thanks,
 
J

Jerry Whittle

In the criteria for the FiscalMonth field put the following:

Format(Date,"MMMM")
 
C

ChuckW

Jerry,

Thanks for your help. This didn't work though. It is a text field which I
cannot change. When I place Format("Date","mmmm") into the criteria
expression it came up with no results but when I took it out, my query result
had a couple of hundred results inclduding records for March. Would this
expression work if the field is text rather than date?
 
J

John W. Vinson

Thanks for your help. This didn't work though. It is a text field which I
cannot change. When I place Format("Date","mmmm") into the criteria
expression it came up with no results but when I took it out, my query result
had a couple of hundred results inclduding records for March. Would this
expression work if the field is text rather than date?

The problem is that you're putting quotemarks around Date so it's being
treated as a string, rather than a function call. Try

Format(Date(), "mmmm")
 
J

John Spencer

Criteria: = Format(Date(),"mmmm")

NOTE the absence of the quote marks around the word Date.

If this fails try
Format(Now(),"mmmm")
In the criteria.

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top