Search on Form

  • Thread starter Thread starter Froto
  • Start date Start date
F

Froto

I have a search form on which I have a text box and a
command button. What I would like to have done is a use
would enter in the short format for month Eg. Jan, Feb,
etc. Once the button is selected it would search the
table for all records belonging to the month selected. My
table stores the date in medium format. Eg. 12-Jan-04.
What code would I need to place behind the onclick button
to make this work.

Thanks for all the help
 
I have a search form on which I have a text box and a
command button. What I would like to have done is a use
would enter in the short format for month Eg. Jan, Feb,
etc. Once the button is selected it would search the
table for all records belonging to the month selected. My
table stores the date in medium format. Eg. 12-Jan-04.
What code would I need to place behind the onclick button
to make this work.

Thanks for all the help

Which YEAR would you like to search? If the user selects Dec next
January, would you want to search December 2005?

The date - regardless of format - is actually stored as a number, a
count of days and fractions of a day (times) since midnight, December
30, 1899. I'd suggest having two combo boxes, one, cboYear, for the
year (with a Default property of Year(Date()) so the user doesn't
usually have to enter it); and the other, cboMonth, with twelve rows
and two columns containing 1, Jan; 2, Feb; etc.

A criterion on the date field of
= DateSerial(Forms!yourform!cboYear, Forms!yourform!cboMonth, 1) AND < DateSerial(Forms!yourform!cboYear, Forms!yourform!cboMonth + 1, 1)

will find all the records in that month.
 
Back
Top