Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

search a field by year when field holds entire date :(

Status
Not open for further replies.
Jan 27, 2003
35
0
0
GB
OK here goes:

I have a table containing personal details, one of the fields is date of birth.

I have a form (form 2)which i use to open another form (form 1)which contains personal data (form 2) is opened from form 1 in order to perform a search (not too important)

Form 2 contains only a text box and a button (created with the wizard) and it works great i can search through the records by typing the full date of birth in the text box i.e 08/08/1978 and clicking the button.

I want to be able to search through the records so that i find all the people born in a specific year, by typing 1978 in the text box how do i do this? should i use a query? I have tried a similar post (in forms)to see if they can come up with anything not to clever with queries so be gentle with explaination
 
The expression Year([DateofBirth]) will return the year in your Field. You can put this in a new column in a query
MyYear:Year([DateofBirth])
and then have your Form look at the field MyYear instead of your DateOfBirth field or you may be able to just change your current button action to look for the Year([DateofBirth]) in your Table and compare it to the value in your textbox. Without actually seeing the form it's hard to say which would be easier.

Paul
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top