MS Access: set focus to a textbox? |
| |
|
|
|
New Poster Posts: 11 Topics: 5
|
|
|
August 14, 2010, 12:29:01 AM
|
|
I am using access 2002 to make a database for a friend, and ran into a functional problem. I have radio buttons that switch that switch the subform, and make a search textbox invisible. Works fine, but when I hit the radio button to reactivate it, I found a problem. The subform changes, the search box comes back, but the radio button I selected still has focus. You have to click or tab back to txtSearch to begin a new search. Although a click or tab isn't much, it doesn't seem like a good way to leave it. I tried txtSearch. SetFocus, but it says it cannot set focus to a textbox. Is there a way around this?
Edit: Removed self promotion links. They are only allowed through signatures.
« Last Edit: August 15, 2010, 10:49:01 PM by Admin »
|
|
| |
|
|
|
Code Guru
Location: India
Gender:  Posts: 1387 Topics: 105
|
|
|
August 15, 2010, 10:44:54 PM
|
|
Have you tried setting the setfocus() for the radio button through javascript? OR try giving the tabindex property of the text box.
|
|
| |
|
|
|
Skilled Coder Posts: 125 Topics: 0
|
|
|
March 03, 2011, 12:47:12 AM
|
|
You have to use setfocus() property of Textbox. You can find this property from the property window of textbox.
|
|
| |
|
|
|
New Coder Posts: 44 Topics: 0
|
|
|
March 30, 2011, 09:41:31 PM
|
|
Please mention the code for that. Thank you.
« Last Edit: April 10, 2011, 09:54:17 PM by Admin »
|
|
| |
|
|
|
New Poster Posts: 1 Topics: 0
|
|
|
July 07, 2011, 10:15:43 AM
|
|
I wanted this too. I found a reference here.
hxxp: www. access-programmers. co. uk/forums/showthread. php?t=151884
Thread: "move cursor to end of text in textbox after setfocus "
There is no stock function, but it can be added very easily. The "Standard Module" they speak of in the topic is the VB code of the Form. Specifically in the (General) area.
Any of your forms will now be-able to access this function. I just tried it and it worked.
Cheers.
|
|
| |
|
|
|
New Coder Real name: Pooja Rani
Posts: 16 Topics: 0
|
|
|
July 10, 2011, 11:04:43 PM
|
|
For this you have to set setfocus() property of Textbox in the property window of textbox as setfocus().
« Last Edit: October 22, 2011, 10:36:42 PM by Admin »
|
|
| |
|
|
|
Regular Coder Posts: 73 Topics: 2
|
|
|
August 06, 2011, 02:16:04 AM
|
|
You don't need to set the focus to get the values.
All you need is to reference your control WITHOUT the .Text part. The default of a control is .Value which can be accessed by using
|
|
| |
|
|
|
Regular Coder Posts: 77 Topics: 0
|
|
|
January 04, 2012, 10:28:16 AM
|
|
Ms acces is easy to learn you just focus on property on text box
|
|
| |