How can I return the name of the field that I had the focus on

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • wassimdaccache
    New Member
    • Apr 2007
    • 222

    How can I return the name of the field that I had the focus on

    Hello guys,

    I am trying to search in a form name "employee_l ist" every unique field.

    The idea is to return the name of the field that had the focus

    I am trying to write this
    Code:
     Dim y As Variant
     y = Application.Screen.PreviousControl.focused
    x = InputBox("Please Enter Your Critiria", "Filter Product List")
    DoCmd.OpenForm "employee_list", , , "[y] LIKE '" & [x] & "*'"
    I am getting in a error with.

    Code:
     y = Application.Screen.PreviousControl.focused

    Please advise me

    Thank you in advance


    WASSIM S DACCACHE
  • missinglinq
    Recognized Expert Specialist
    • Nov 2006
    • 3533

    #2
    Should be

    y = Application.Scr een.PreviousCon trol.Name


    The fact that the f in focused wasn't capitalized when you moved off the line tells you that focused isn't a valid property.

    Linq ;0)>

    Comment

    • wassimdaccache
      New Member
      • Apr 2007
      • 222

      #3
      Originally posted by missinglinq
      Should be

      y = Application.Scr een.PreviousCon trol.Name


      The fact that the f in focused wasn't capitalized when you moved off the line tells you that focused isn't a valid property.

      Linq ;0)>
      Appreciate you feedback.

      Could you please help me by getting the data of the previous field focused.
      I mean the content (data)

      by the way why on my access vb page when I write previouscontrol and then DOT a combo will automatically expand and it is not containing the "name" property.
      Thank you in advance


      Best Regards;

      WASSIM S DACCACHE

      Comment

      • missinglinq
        Recognized Expert Specialist
        • Nov 2006
        • 3533

        #4
        Content = Application.Scr een.PreviousCon trol.Value

        and actually, the .Value is not neccessary, as Value is the Default Property of textboxes, comboboxes, etc. so

        Content = Application.Scr een.PreviousCon trol

        will work just as well!

        Linq ;0)>

        Comment

        • wassimdaccache
          New Member
          • Apr 2007
          • 222

          #5
          Originally posted by missinglinq
          Content = Application.Scr een.PreviousCon trol.Value

          and actually, the .Value is not neccessary, as Value is the Default Property of textboxes, comboboxes, etc. so

          Content = Application.Scr een.PreviousCon trol

          will work just as well!

          Linq ;0)>

          It works I appreciate you quick reply :)


          THANK YOU VERY MUCH


          TAKE CARE

          Comment

          • missinglinq
            Recognized Expert Specialist
            • Nov 2006
            • 3533

            #6
            Glad we could help!

            Linq ;0)>

            Comment

            Working...