By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,335 Members | 2,313 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,335 IT Pros & Developers. It's quick & easy.

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

100+
P: 222
Hello guys,

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

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

I am trying to write this
Expand|Select|Wrap|Line Numbers
  1.  Dim y As Variant
  2.  y = Application.Screen.PreviousControl.focused
  3. x = InputBox("Please Enter Your Critiria", "Filter Product List")
  4. DoCmd.OpenForm "employee_list", , , "[y] LIKE '" & [x] & "*'"
  5.  
I am getting in a error with.

Expand|Select|Wrap|Line Numbers
  1.  y = Application.Screen.PreviousControl.focused

Please advise me

Thank you in advance


WASSIM S DACCACHE
May 9 '08 #1
Share this Question
Share on Google+
5 Replies


missinglinq
Expert 2.5K+
P: 3,532
Should be

y = Application.Screen.PreviousControl.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)>
May 9 '08 #2

100+
P: 222
Should be

y = Application.Screen.PreviousControl.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
May 9 '08 #3

missinglinq
Expert 2.5K+
P: 3,532
Content = Application.Screen.PreviousControl.Value

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

Content = Application.Screen.PreviousControl

will work just as well!

Linq ;0)>
May 9 '08 #4

100+
P: 222
Content = Application.Screen.PreviousControl.Value

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

Content = Application.Screen.PreviousControl

will work just as well!

Linq ;0)>

It works I appreciate you quick reply :)


THANK YOU VERY MUCH


TAKE CARE
May 9 '08 #5

missinglinq
Expert 2.5K+
P: 3,532
Glad we could help!

Linq ;0)>
May 9 '08 #6

Post your reply

Sign in to post your reply or Sign up for a free account.