I am creating a registration database and there will be almost 900 records. I want to be able to search those records within the current record form by last name. How do I do that using a text box and command button?
morg27
If you are interested in a way to populate either a list box or a combo box with just the records you want to see, and select the records you want to see by entering a value in a text box, here is a method...
1. Create a text box which you will use to enter the search criteria for the combo box. Let's call it txtSearch.
2. Create a combo box which will look up values in your table. Let's call it cboSearch.
3. Open the SQL behind the combo box. In the field upon which you want to do the search, in your case LastName, put
Like Forms!yourFormName!txtSearch & "*"
4. In the forms Current event, put Me.cboSearch = Null. This will empty the combo box each time the form is updated.
5. In the AfterUpdate event for the txtSearch text box, put...
Me.cboSearch.Requery (so that the combo box gets requeried each time the text box is updated)
morg27
Okay, let's assume that you have 2 additional fields in the table through which you are searching. Those two fields would be RecordID and FirstName. Typically, the RecordID field would be hidden, so the combo, or list, box results would be something such as...
Brown, Cedric
Brown, James
Brown, Samuel
That would allow you to select the last name you wanted, by the match with the first name.
What you do from there on depends on what you want to do. Print a report, or something else? Go to that person's records?
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.