I'm in the need of some code, which search for names in records depending on user entry in some text boxes.
I have a Query (qryChurchBooks) with following Fields:
- Name
- Maiden_name
- Date
- Parish
- Type_book
- Year_book
On a Form (frmSearch), I have some text boxes, where a user can write info, which should be searched for. The text boxes are:
- Search_name
- Search_maiden_name
- Search_type_book (the is a combo with flwg entries (All, Born, Marriage, Death)
- Year_from
- Year_to
The idea is that the [Search_name] and the [Search_type_book] text boxes are mandatory, before clicking the Search button..
The user should be able to use the common wildcard characters in the [Search_name] text box.
If [All] I chosen in the [Search_tpe_book] then all records should be included in the search. If e.g. [Born] is chosen, then only records with the value [Born] in the [Type_book field] should be included in the search. And so on with [Marriage] and [Death].
The text boxes [Search_maiden_name], [Year_from] and [Year_to] are used to limit the results of a search.
If you are searching for a person with the name e.g. 'Jane Doe', you might get 100's of results, however if you know that her maiden name was Smith, you can enter 'Jane Doe' in the [Search_name] text box and 'Smith' in the [Search_Maiden_name] text box. Then only results where both match, should be shown.
The same thing goes for the [Year_from] and [Year_to] text boxes. If you know that a person e.g. was born somewhere between 1890 and 1910, those years should be entered in the text boxes, hence limiting the results.
Finally the results should be shown in a Listbox on the same frmSearch as above, with the columns: Name, MaidenName, TypeBook, Date, Parish & YearBook.
I hope above is clear and understandable. Otherwise please ask, and I will try to elaborate.
I would highly appreciate any assistance as text (e.g. the code written in the reply), in stead of an attached file sample, as I can not open/use attached files, where I currently am (a very un-civilized place : ).
Thanks.
/Anders
I have a Query (qryChurchBooks) with following Fields:
- Name
- Maiden_name
- Date
- Parish
- Type_book
- Year_book
On a Form (frmSearch), I have some text boxes, where a user can write info, which should be searched for. The text boxes are:
- Search_name
- Search_maiden_name
- Search_type_book (the is a combo with flwg entries (All, Born, Marriage, Death)
- Year_from
- Year_to
The idea is that the [Search_name] and the [Search_type_book] text boxes are mandatory, before clicking the Search button..
The user should be able to use the common wildcard characters in the [Search_name] text box.
If [All] I chosen in the [Search_tpe_book] then all records should be included in the search. If e.g. [Born] is chosen, then only records with the value [Born] in the [Type_book field] should be included in the search. And so on with [Marriage] and [Death].
The text boxes [Search_maiden_name], [Year_from] and [Year_to] are used to limit the results of a search.
If you are searching for a person with the name e.g. 'Jane Doe', you might get 100's of results, however if you know that her maiden name was Smith, you can enter 'Jane Doe' in the [Search_name] text box and 'Smith' in the [Search_Maiden_name] text box. Then only results where both match, should be shown.
The same thing goes for the [Year_from] and [Year_to] text boxes. If you know that a person e.g. was born somewhere between 1890 and 1910, those years should be entered in the text boxes, hence limiting the results.
Finally the results should be shown in a Listbox on the same frmSearch as above, with the columns: Name, MaidenName, TypeBook, Date, Parish & YearBook.
I hope above is clear and understandable. Otherwise please ask, and I will try to elaborate.
I would highly appreciate any assistance as text (e.g. the code written in the reply), in stead of an attached file sample, as I can not open/use attached files, where I currently am (a very un-civilized place : ).
Thanks.
/Anders