PDA

View Full Version : Force form to loose focus



boc_est1986
09-20-2011, 06:12 AM
I have a form that shows all data from a table (created usign the wizard) i am using the built in search function from a button. I have all everythings set as enabled = false but use the search function i have to put everything as enabled = true. Once the user has finished with the find/replace box that is used as the default search i want to set everything to enabled = false again. I have been trying to use the forms lostfocus and deactivate events but neither of these work. Does anyone have any suggestions

HiTechCoach
09-21-2011, 10:54 AM
Instead of setting the Enabled property to False use just set locked property set to Yes. Then you do not have to change the Enabled property. Just leave the locked property set to true to prevent edits.

What I find even easier to prevent edits is the change the form's record source type to snapshot. This also helps with performance.

boc_est1986
09-21-2011, 11:04 PM
thanks for the reply i'll give it a try

boc_est1986
09-22-2011, 05:12 AM
i've set everything to locked instead of enabled and for most things it works much better. However i am still having the same issue with the find function. It seems that to be able to use the find fucntion something must have focus, with everything locked nothing has focus. I'm then back to the same problem of unlocking everything and setting the focus befor the find dialog is called but then have no way of locking them after

boc_est1986
09-22-2011, 05:49 AM
sorry, it works a treat. i forgot to take all the default enabled = no settings off

HiTechCoach
09-22-2011, 09:12 AM
With the enabled property set to no the control can not get teh focus. Setting the locked to Yes and Enabled yes allows the control to get the focus. This allows the Find to work.

Glad to hear you have it sorted out.