A
Andrew
I have a form which has a number of search fields in the header section and
the results are displayed within the details section.
I want to be able to return the user back to the last field that they
changed within the Header Section if on clicking the custom search button no
records are found.
I have used 'Screen.PreviousControl.SetFocus' which mostly works, but only
works if the user directly clicks the search button after entering their
search in the field box. If the user enters something in one of the search
fields and then tabs to the next search field then this method does not
return the user to the last 'edited' field.
What I want to do is - after a user changes one of the searchfields, store
the 'name' of the search field either in a hidden field on the form or as
some type of form variable. After the user clicks the search button and no
records are returned, set the focus back to the 'field name' stored in the
hidden field or variable
ie - SomeVar = me.HiddenField.value
me.SomeVar.setfocus
unfortunately Access exits at this point or says somethink like 'type
mismatch'.
Is there anyway you can substitute in a variable name using the setfocus
method.
Thanks Andrew
PS I also tried - things like Me.Controls("SomeVar").SetFocus - but without
any luck
the results are displayed within the details section.
I want to be able to return the user back to the last field that they
changed within the Header Section if on clicking the custom search button no
records are found.
I have used 'Screen.PreviousControl.SetFocus' which mostly works, but only
works if the user directly clicks the search button after entering their
search in the field box. If the user enters something in one of the search
fields and then tabs to the next search field then this method does not
return the user to the last 'edited' field.
What I want to do is - after a user changes one of the searchfields, store
the 'name' of the search field either in a hidden field on the form or as
some type of form variable. After the user clicks the search button and no
records are returned, set the focus back to the 'field name' stored in the
hidden field or variable
ie - SomeVar = me.HiddenField.value
me.SomeVar.setfocus
unfortunately Access exits at this point or says somethink like 'type
mismatch'.
Is there anyway you can substitute in a variable name using the setfocus
method.
Thanks Andrew
PS I also tried - things like Me.Controls("SomeVar").SetFocus - but without
any luck