Search Button

G

Guest

Hi

I need a on click event procedure to do the following.

I have three unbound fields (txtSurname, txtfirst, txtmemno) which when
poeple click on the search button it searchs my tables and finds any records
which match the criteria entered in the fields. Other requirements of the
search is that they must not have resigned or be deceased (these two are tick
boxes).

I also need the results to update my list box Showing the folllowing fields
(member No, Surname, Given Name, Suburb).

Think i have covered most of it. Hope someone can help me. I know what i
want but just dont know how to do it. I know my way around access a little
bit.

Thanks

Andrew
 
A

Allen Browne

For an example of how to build the WHERE string based on whatever
combination of unbound controls the user enters values into, download this
sample database for Access 2000 and later:
http://allenbrowne.com/unlinked/Search2000.zip

You will need to add to that string:
strWhere = strWhere & "(Resigned = False) AND (Deceased = False)"

To assign the results to the list box, you need to complete the rest of the
SQL statement, and assign it to the RowSource property of the list box,
e.g.:
strSql = "SELECT [member No], Surname, [Given Name], Suburb " & _
FROM Table1 WHERE " & strWhere
Me.[List1].RowSource = strSql
 

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