• Searching a Form (v2000)

    Author
    Topic
    #364644

    I have a form containing employee information. We use it for data entry and also to search for SSN, names, dates of birth, etc. On the menu bar I added the binoculars to run searches.
    I know this is a petty concern but the default search is an exact match search in the one text box where the cursor resides. Also, the search box cover up the form.
    To make the search more useful for our needs, I created an unbound text box in the body of the form. The user can type a name, DOB, address, anything in the unbound text box. I then set-up a command button to search all the bound text boxes in the form for all records containing any part of the field from the unbound box. However, when I use “docmd.FindRecord” it doesn’t properly find the contents of the unbound box (I know I have to set the focus to a bound box before running the code but it still doesn’t work).
    What am I doing wrong and is there a better approach to fit my needs?
    Thanks

    Viewing 0 reply threads
    Author
    Replies
    • #560556

      As you don’t know what the user is searching for, you have to search in all fields of your form. You have to use acAll in the docmd.findrecord.

      DoCmd.FindRecord NameOfUnboundTextBox, acEntire, False, acSearchAll, , acAll

      Depending of the number of controls on the form and the number of records, this can be very slow

      Maybe it would be better to learn your users to use the ‘Filter by Form’ button

      • #562164

        Francois,
        Thanks a bunch. The database is relatively small so volume won’t be a problem. I want to make it as simple as possible so thanks for the information!!

    Viewing 0 reply threads
    Reply To: Searching a Form (v2000)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: