Currant Month code not working

lsearcey

Board Regular
Joined
Sep 8, 2003
Messages
139
I put the following info in the criteria section on a query for a table and it says that "the expression you entered has a fuction containing the wrong number of arguments"

=format(Month(Now(),mmm)&format(Year(Now(),yy)

I'm try to find a way to get it to filter out just the currant month from the Enroll Month field. The table field the query is looking at has the date listed in 01/01/2005 format.

Thank You
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
Hi
You are missing some closing brackets and some quotes. Try this instead:
Format(Month(Now()),"mmm") & Format(Year(Now()),"yy")
HTH, Andrew :)
 
Upvote 0
On reflection I don't think this will give you what you want given the format of the enrol date field is different to what you were trying to do in your criteria. If you are trying to filter a date field in a query just to include the records from the current month, then use this criteria under your enrol date field :

Code:
>DateAdd("d",-Day(Date()),Date()) And <DateSerial(Year(DateAdd("m", 1 ,Date())), Month(DateAdd("m", 1, Date())), 1)

This picks up all records after the last day of the previous month and before the first day of the next month.

BTW a format of 01/01/2005 could be either 1 Jan 2005 or Jan 1 2005 depending on where you are from and what sort of date convention you use.

HTH, Andrew :)
 
Upvote 0

Forum statistics

Threads
1,203,172
Messages
6,053,888
Members
444,692
Latest member
Queendom

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top