Long Date Search - JCW

J

JohnW

I have a field called birthdate that I have formatted for long date so when
the user inputs the date as 8/21/1999 the month name August will appear in
the field also. I want to be able to serach for all birthdays in a month but
when I set the search criteria in my query to search for a name of a month it
does not find anything. It will find numbers from this field but not text.
How can I do this?

Thanks for the help.
 
K

KARL DEWEY

I have formatted for long date
Format is just control of the display but it does nothing to the way the
data is stored.
If you want to enter the name of a month then you either need to convert
your search entry or convert the date so as to apply month name (text) as
criteria.

Name for search --
SomeDate: Format([YourDateField], "mmmm yyyy")
Criteria --- [Enter Month Year (April 2005)]

The other way you need a translation table from text to month number to
convert your search entry to a date.
 
J

John W. Vinson

I have a field called birthdate that I have formatted for long date so when
the user inputs the date as 8/21/1999 the month name August will appear in
the field also. I want to be able to serach for all birthdays in a month but
when I set the search criteria in my query to search for a name of a month it
does not find anything. It will find numbers from this field but not text.
How can I do this?

Thanks for the help.

Regardless of the format, a Date/Time field is actually stored as a Double
Float number, a count of days and fractions of a day (times) since midnight,
December 30, 1899. The Format just controls how it's displayed - the date does
NOT contain the text string "August" at all.

To get all birthdates that fall in August (of any month, August 1921 or August
2004) use a Query with a calculated field; you could type

BirthMonth: Format([birthdate], "mmmm")

This wiill give a text string, "August" or "May" or whatever, and can be used
for search criteria.
 
J

JohnW

John - this worked great. Thanks for your help.
--
JCW


John W. Vinson said:
I have a field called birthdate that I have formatted for long date so when
the user inputs the date as 8/21/1999 the month name August will appear in
the field also. I want to be able to serach for all birthdays in a month but
when I set the search criteria in my query to search for a name of a month it
does not find anything. It will find numbers from this field but not text.
How can I do this?

Thanks for the help.

Regardless of the format, a Date/Time field is actually stored as a Double
Float number, a count of days and fractions of a day (times) since midnight,
December 30, 1899. The Format just controls how it's displayed - the date does
NOT contain the text string "August" at all.

To get all birthdates that fall in August (of any month, August 1921 or August
2004) use a Query with a calculated field; you could type

BirthMonth: Format([birthdate], "mmmm")

This wiill give a text string, "August" or "May" or whatever, and can be used
for search criteria.
 

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

Top