Year Beginning Date

  • Thread starter Thread starter Scott
  • Start date Start date
S

Scott

I want to run a YTD report that will return the first day (January 1) of the
same year of a date (ending date) that I manually enter on a form. If the
date is any month, any day of 2009 then I want the date 1/1/2009 returned.
If the month ending date is any date, any month of 2008 then I want the date
1/1/2008 returned. What is the formatting I would use to return January 1 of
the same year as a manually entered date on a form?
 
In query design view scroll to righ to an empty spot in the Field row and
enter this using your actual field name --
qryYear: Format([YourDateField], "yyyy")

Under that in the Criteria row type in this using your form name and text
box ---
Format([Forms]![YourFormName]![YourTextBox], "yyyy")
 
Scott,

I think what you are looking for is the DateSerial( ) function. Something
like:

StartDate: DateSerial(Year(form!yourForm.txtSomeDate), 1, 1)
 
Back
Top