scubadiver007
Registered User.
- Local time
- Today, 10:52
- Joined
- Nov 30, 2010
- Messages
- 317
Hello,
I have a form with three text boxes and a subform that lists records.
searchforename
searchsurname
SearchDOB
I have a query on which I would like to perform two different searches.
1) Partial surname only (this is for updating records)
First criteria line:
Cand_surname: Like [forms]![Form_candidates_search]![searchsurname] & "*"
2) Complete forename, complete surname and date of birth (this to check whether an individual has a record on the database prior to registration)
Second criteria line
Cand_forename: [forms]![Form_candidates_search]![searchforename]
Cand_surname: [forms]![Form_candidates_search]![searchsurname]
Cand_DOB: [forms]![Form_candidates_search]![searchDOB]
The first search works okay but if I put in my own complete name but a fake birth date, my record still appears in the form's subform.
I have a form with three text boxes and a subform that lists records.
searchforename
searchsurname
SearchDOB
I have a query on which I would like to perform two different searches.
1) Partial surname only (this is for updating records)
First criteria line:
Cand_surname: Like [forms]![Form_candidates_search]![searchsurname] & "*"
2) Complete forename, complete surname and date of birth (this to check whether an individual has a record on the database prior to registration)
Second criteria line
Cand_forename: [forms]![Form_candidates_search]![searchforename]
Cand_surname: [forms]![Form_candidates_search]![searchsurname]
Cand_DOB: [forms]![Form_candidates_search]![searchDOB]
Code:
SELECT table_candidate.Cand_ID, table_candidate.Cand_forename, table_candidate.Cand_surname, table_candidate.Cand_addr1, table_candidate.Cand_addrpc, table_candidate.Cand_DOB
FROM table_candidate
WHERE (((table_candidate.Cand_forename) Is Not Null) AND ((table_candidate.Cand_surname) Like [forms]![Form_candidates_search]![searchsurname] & "*") AND ((table_candidate.Cand_DOB) Is Not Null)) OR (((table_candidate.Cand_forename)=[forms]![Form_candidates_search]![searchforename]) AND ((table_candidate.Cand_surname)=[forms]![Form_candidates_search]![searchsurname]) AND ((table_candidate.Cand_DOB)=[forms]![Form_candidates_search]![searchDOB]))
ORDER BY table_candidate.Cand_surname;
The first search works okay but if I put in my own complete name but a fake birth date, my record still appears in the form's subform.