Set Focus and Requery Data

samjh

Registered User.
Local time
Today, 07:45
Joined
Jan 10, 2013
Messages
64
Hi,

I have a Dynamic Search form, which I use to search for client, on the double click it takes me to the client, at which point I have the Forms Visible set to False.

When I click on a button to open that Form, the Visible turns back to True, however it shows my last search results, how do I clear it so that when I call it back up it is ready to search again, and my focus is set to the SearchFor box.

thanks
 
Rather than changing the form Visible property from False to True, why not simply open the form using the current record as the Where Condition of the OpenForm method :confused: The user can then close the form once they are done.
 
Sorry my original query doesn't make sense.

The double click that open the selected form on the correct filter works fine, it the Dynamic Search form that I wasnt to requery when it is called on, for example if I have typed in smith on the search box, double click to open the form for smith then go back to search again, it is still on Smith. I want it to have nothing in the search box, without have to close it an open it everytime.
 
Try the following code, it must be in the seachform and the form must be visible.
Code:
  Dim Ctrl As Control
 
  For Each Ctrl In Me.Controls ' Iterate through each element.
    If Ctrl.ControlType = 109 Then '"Field"-Type
       Ctrl = Null
     End If
  Next
  Me.SearchFor.SetFocus
 

Users who are viewing this thread

Back
Top Bottom