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 by date problem :-(

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?
 
No guarantees but seems to work in my search routine - try using * as a wild card, i.e. type */1978 in the search box

 
Maybe an SQL select with
Code:
SELECT * FROM tablename WHERE DatePart("yyyy", DateField) = txtDateSelect
and use this string as the .RowSource for a list box would work? PeteJ
(Contract Code-monkey)

It's amazing how many ways there are to skin a cat
(apologies to the veggies)
 
You could try adding a non-displayed field (call it [FormatDate]) to your form's RecordSource whose ControlSource is Format([birth date],"mm/dd/yyyy").

Then, if a less-than-full date is entered, change the filter to [Format Date] Like "*" & [textbox] & "*".
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top