Page 1 of 2 12 LastLast
Results 1 to 15 of 26
  1. #1
    zareh is offline Novice
    Windows 7 64bit Access 2003
    Join Date
    Jan 2013
    Posts
    29

    Identifying the field in a subform


    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

  2. #2
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows XP Access 2003
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,545
    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

  3. #3
    zareh is offline Novice
    Windows 7 64bit Access 2003
    Join Date
    Jan 2013
    Posts
    29
    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

  4. #4
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,746
    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.

  5. #5
    zareh is offline Novice
    Windows 7 64bit Access 2003
    Join Date
    Jan 2013
    Posts
    29
    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
    Attached Files Attached Files

  6. #6
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,746
    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 explained my intention in other posts.
    I don't understand what you're trying to do based on your sample database.
    I don't understand the form nor the data in your table.

  7. #7
    trevor40's Avatar
    trevor40 is offline Advanced db Manager
    Windows XP Access 2003
    Join Date
    Feb 2014
    Location
    Australia
    Posts
    402
    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

  8. #8
    zareh is offline Novice
    Windows 7 64bit Access 2003
    Join Date
    Jan 2013
    Posts
    29
    Quote Originally Posted by trevor40 View Post
    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


    Thanks a lot. I will try.

  9. #9
    zareh is offline Novice
    Windows 7 64bit Access 2003
    Join Date
    Jan 2013
    Posts
    29
    Quote Originally Posted by orange View Post
    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 don't understand the form nor the data in your table.

    i want to search a sub-form based on the item the user enters in another form. Exactly like access "find" window.

  10. #10
    zareh is offline Novice
    Windows 7 64bit Access 2003
    Join Date
    Jan 2013
    Posts
    29
    Quote Originally Posted by trevor40 View Post
    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

    Lost focus action of the sub form is not triggered when sub form losses the focus!!!!!!!!!!!!

  11. #11
    trevor40's Avatar
    trevor40 is offline Advanced db Manager
    Windows XP Access 2003
    Join Date
    Feb 2014
    Location
    Australia
    Posts
    402
    Damm... I'll get back to you...

  12. #12
    trevor40's Avatar
    trevor40 is offline Advanced db Manager
    Windows XP Access 2003
    Join Date
    Feb 2014
    Location
    Australia
    Posts
    402
    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.

  13. #13
    zareh is offline Novice
    Windows 7 64bit Access 2003
    Join Date
    Jan 2013
    Posts
    29
    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.

  14. #14
    MarvinM's Avatar
    MarvinM is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Dec 2013
    Posts
    30

    Thumbs up

    Code:
    = Screen.ActiveControl.Name

  15. #15
    zareh is offline Novice
    Windows 7 64bit Access 2003
    Join Date
    Jan 2013
    Posts
    29
    Thanks a lot . I will try.

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Identifying the Parent Page in a subform
    By EddieN1 in forum Forms
    Replies: 5
    Last Post: 08-01-2013, 05:13 PM
  2. Identifying where two tables are different
    By Bdowns in forum Queries
    Replies: 1
    Last Post: 01-17-2013, 01:23 PM
  3. Need help identifying what to do....?
    By shands in forum Access
    Replies: 7
    Last Post: 09-29-2011, 11:49 AM
  4. Identifying the first entry
    By HelenP in forum Access
    Replies: 8
    Last Post: 10-20-2010, 08:31 PM
  5. Identifying new data
    By manicamaniac in forum Programming
    Replies: 5
    Last Post: 04-28-2010, 11:08 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums