Results 1 to 3 of 3
  1. #1
    3 Star Lounger
    Join Date
    Dec 2001
    Location
    Royal Oak, Michigan, USA
    Posts
    255
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Searching a Form (v2000)

    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

  2. #2
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Searching a Form (v2000)

    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
    Francois

  3. #3
    3 Star Lounger
    Join Date
    Dec 2001
    Location
    Royal Oak, Michigan, USA
    Posts
    255
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Searching a Form (v2000)

    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!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •