I just tried this: I went into the tools/options for edit/find and
changed default to general search and that seems to have given me what I
wanted.
But why would the original code for set focus not work in Access2002?
On 7/10/2011 12:01 PM, Advance Scout wrote:
> I recently converted an access 97 application to access 2002. My
> "customer information form" has a search button that when pressed opened
> another form with 3 additional search option buttons on it.
>
> One of those 3 buttons, "search by name", used to open the "find" dialog
> box which worked perfectly in Access97 (and still does). But in Access
> 2002 it is creating an error.
>
> Now when I click that button I get a "Find and Replace" dialog box.
> (Access97 was just a "find" dialog box). When data is entered into the
> "find what" field and you press the search button you get this error:
>
> "The control "command76" macro is attempting to search cant be searched.
> . Try one of the following....
> *add a goto control action before the findrecord action
> *for the findrecord action,change the only current field action argument
> from yes to no
> *change the focus to a searchable control "
>
>
> The code for the "on click event" for that search button is:
>
> Forms!frmCustomerInvoice.SetFocus
> DoCmd.DoMenuItem acFormBar, acEditMenu, 10, , acMenuVer70
>
> and it works on Access97, but apparently not on Access 2002.
>
> I now changed the code to:
> Forms!frmCustomerInvoice!.contactLastName.SetFocus
> DoCmd.RunCommand acCmdFind
>
> and its working but the new "Find and replace" dialog box is filling in
> contactlastname as the "look in:" and once it finds the first match it
> wont find any others. If I manually change the "look in:" to the forms
> name it will then find any others that match.
>
> So- what code can I try so that it will focus back on the form and not
> fill in the "look in" box with the field to search, or fill in the "look
> in:" box with the form name? Using just
> "Forms!frmCustomerInvoice.SetFocus" does not seem to work in Access2002.
|