I have a sub form with some fields. I need to identify the last field which had the focus after leaving the sub form.
Any ideas?
Thanks
I have a sub form with some fields. I need to identify the last field which had the focus after leaving the sub form.
Any ideas?
Thanks
This is not something usual. Can you tell us why you need this, and explain a little about what you are trying to do.
If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
Bob Fitzpatrick
Please have a look at. https://www.accessforums.net/program...tml#post214728
I need to use FindRecord command to create a "Find" window like in Access.
Nobody so far could help me. My problem is explained in the other post. Please note post #6 .
Thanks
Further to Bob's request, could you tell us in plain English WHAT you are trying to do. The issue at the moment is that readers are guessing your intentions. So a simple, clear, plain English (no technical Access terms) would help.
I explained my intention in other posts.
The file I attached (here and https://www.accessforums.net/programm...tml#post214728) is an example not a working database.
I need to create "Find" Window in Access. In this window , the user can enter the search item and this window finds it anywhere the focus is.
This is done and I have a program which does this BUT I can not see the codes. SO FAR nobody could give me any help.
In the example I attached , I tried this from a text box on the form (where subform is) , you can see that it works. BUT when another window is opened and search item is given, I get error. I know where the problem is : I can not identify the field in the sub form where I need the search done.
Another puzzling thing : when I put toggle break point before the FindRecord , program stops and when F5 is pressed , it finds the item without any error!!!!!!
Thanks
How come you have 2 threads on this topic? Did you look at my comments in the other post?
I see you did not respond.
I don't understand what you're trying to do based on your sample database.I explained my intention in other posts.
I don't understand the form nor the data in your table.
create an unbound text box "previous_control" on your main form,
on the lost focus action of your subform put VBA
Private Sub Your_SubForm_LostFocus()
Forms![main form]![previous_control]= Screen.PreviousControl
end sub
i want to search a sub-form based on the item the user enters in another form. Exactly like access "find" window.
Lost focus action of the sub form is not triggered when sub form losses the focus!!!!!!!!!!!!
Damm... I'll get back to you...
Ok then, you may have to put this into each field OnLostFocus action on your subform
Private Sub text_box_1_LostFocus()
Forms![main form]![previous_control]= Screen.PreviousControl
End Sub
the value on the main form will keep changing as you move around the form fields
and the 'last field' value will be there when the form loses focus.
Thanks.
But this is not helping me. This shows the value of the last field not the field name and also I need the current field name in which the focus is not the previous one.
Thanks anyway.
Code:= Screen.ActiveControl.Name
Thanks a lot . I will try.