year search

  • Thread starter Thread starter brino
  • Start date Start date
B

brino

hi all !

i need a user to select a year from a list eg . 2007,2008,2009 when
searching in a form that will run a query .
however the date format in the table is eg. "31/3/09" .
how can i just search through the year part of the date using this
method ?
i think there is some simple code you have to type in the query but im
not sure what it would be.

thanks
 
hi all !

i need a user to select a year from a list eg . 2007,2008,2009 when
searching in a form that will run a query .
however the date format in the table is eg. "31/3/09" .
how can i just search through the year part of the date using this
method ?
i think there is some simple code you have to type in the query but im
not sure what it would be.

thanks

The format is completely irrelevant: a Date field (whatever format) is stored
as a double float number, a count of days and fractions of a day since
midnight December 30, 1899.

You can use a query criterion such as
= DateSerial([Forms]![formname]![cboYear], 1, 1) AND < DateSerial([Forms]![formname]![cboYear] - 1, 1, 1)

to search the range of dates during that year.
 
I think you want some thing in the vein of :

SELECT Year([DateOfInterest]) AS Year FROM tblYourName;

That will give you 2005, 2006, 2007 et al.

You can make that query the source for a combo box

Regards

Kevin
 

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

Back
Top