locked
SetFocus fails on unbound for control RRS feed

  • Question

  • I cant see any logical reason Im getting an error when, from a main form, I attempt to use SetFocus to activate a control on an unbound subform. I have even used the Timer event to delay the action to no avail. I have tried setting the focus first to the subform control itself, then the control on the underlying form, and again, no luck.

    Does anybody here know whats causing the failure?

    Thanks


    50% of programming is coding. The other 90% is debugging

    Wednesday, September 30, 2015 4:20 AM

Answers

  • It is a textbox and enabled. I found what the issue was. I was using the Exit event of a control to move to a blank form and under circumstances, setfocus to that textbox. Now that I have inadvertently moved that behavior to the KeyDown instead, it works. Thanks though Dirk

    50% of programming is coding. The other 90% is debugging

    • Marked as answer by JonWayn Wednesday, September 30, 2015 5:41 AM
    Wednesday, September 30, 2015 5:41 AM

All replies

  • I cant see any logical reason Im getting an error when, from a main form, I attempt to use SetFocus to activate a control on an unbound subform. I have even used the Timer event to delay the action to no avail. I have tried setting the focus first to the subform control itself, then the control on the underlying form, and again, no luck.

    Does anybody here know whats causing the failure?

    Is the control enabled?  Is it of a type that is capable of receiving the focus?  What event are you doing this in?

    And most importantly, what error are you getting?


    Dirk Goldgar, MS Access MVP
    Access tips: www.datagnostics.com/tips.html

    Wednesday, September 30, 2015 4:42 AM
  • It is a textbox and enabled. I found what the issue was. I was using the Exit event of a control to move to a blank form and under circumstances, setfocus to that textbox. Now that I have inadvertently moved that behavior to the KeyDown instead, it works. Thanks though Dirk

    50% of programming is coding. The other 90% is debugging

    • Marked as answer by JonWayn Wednesday, September 30, 2015 5:41 AM
    Wednesday, September 30, 2015 5:41 AM