Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Check to see what has focus

Status
Not open for further replies.

pappy1271

MIS
Sep 17, 2001
16
0
0
US
This is what I want to do.
Have serveral Text boxes that are locked on a form so that the information cannot be changed. I want the user to click to give the focus to the proper box they want to change. Then when they click a command button access checks to see which text box has the focus and changes that property to locked = false. Another words just like with the search. Which ever field you are in that is where the search is performed. Any ideas?

Thanks,
 
pappy: I use a similar approach on Edit forms. I have a button that changes its caption from "Edit" to "Lock" and write the code based on its caption (IF..Then). When the user clicks on the Edit button, it unlocks the various textboxes and combo boxes, etc... and the user can then proceed to edit. When finished, they click on the buton again and relock the fields.

If you are going to use your approach, then you need to know where the focus was before you "click" on the button. One method may be the following:

Screen.PreviousControl.Locked = "false"

That is, the user can click in the textbox they want to edit, then click your Edit button to unlock it. In your code you can send the focus back.

There is a nice Do...Until procedure that can loop through the objects on the form and "find" the one that has the focus and unlocked it. This could be triggered by using a function called on the "OnGotFocus" event of each textbox.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top