Connecting Tech Pros Worldwide Forums | Help | Site Map

Function to Return 1st of Month

Newbie
 
Join Date: Mar 2007
Location: North Wales
Posts: 2
#1: Apr 19 '07
I have a form in Access with 2 date fields for completion. I want to query data from the 1st of the month (e.g. 01 April, 2007) to yesterday. For yesterday I use '=Date()-1', which works great but can't figure out what to use for the other date field.

Will I need to write a function to return this date? Will the function use 'Date' to retrieve the information or will it use the date field box name?

Hope you can help with this, it is driving me crazy!

Rabbit's Avatar
Expert
 
Join Date: Jan 2007
Location: California
Posts: 3,835
#2: Apr 19 '07

re: Function to Return 1st of Month


This will return the first day of the current month of the current year.
Expand|Select|Wrap|Line Numbers
  1. CDate(Month(Date()) & "/1/" & Year(Date()))
Reply