Results 1 to 6 of 6

Thread: ***Resolved*** SetFocus problem

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Nov 2001
    Location
    Bangkok
    Posts
    969

    ***Resolved*** SetFocus problem

    Hi everybody,

    I use many times Private Sub Form_Load to set some parameters in the Form before the use use it. But I need to set on Fields .SetFocus to start with the correct textfield. Unfortunatly it seems that with Form_Load are the controls are still not loaded. How can I set at Form-start any SetFocus that I want?

    In Access exist a Sub that can be called AFTER the form is loaded. I didn't find this in VB.

    Any idea how to set the SetFocus?


    Franky
    Last edited by Franky; Jul 6th, 2002 at 03:31 PM.

  2. #2
    zemp
    Guest
    Use the form activate event. When a form is load the load event fires and then the activate event fires when the form becomes the active form.

  3. #3
    PowerPoster
    Join Date
    Aug 2000
    Location
    IN SILENCE
    Posts
    6,441

    Well

    Use something like this :

    VB Code:
    1. ' In Form Load
    2.  
    3. ' Additional Code
    4.  
    5. Me.Show
    6.  
    7. Text1.SetFocus

    Problem is you cannot set focus to a control that has not been visually "seen" yet...
    Remaining quiet down here !!!

    BRAD HAS GIVEN ME THE ULTIMATIVE. I have chosen to stay....

  4. #4
    New Member
    Join Date
    Jun 2002
    Posts
    13
    try this lines:
    load form1
    form1.show
    Last edited by JosephNUy; Jul 4th, 2002 at 09:54 PM.

  5. #5
    Don't Panic! Ecniv's Avatar
    Join Date
    Nov 2000
    Location
    Amsterdam...
    Posts
    5,343
    Or look at your tab order and the text field you want to start in set to 0....



    Vince

    BOFH Now, BOFH Past, Information on duplicates

    Feeling like a fly on the inside of a closed window (Thunk!)
    If I post a lot, it is because I am bored at work! ;D Or stuck...
    * Anything I post can be only my opinion. Advice etc is up to you to persue...

  6. #6

    Thread Starter
    Fanatic Member
    Join Date
    Nov 2001
    Location
    Bangkok
    Posts
    969

    Thanks everybody

    Nice ideas from all of you. But the best is of course the

    Private Sub Form_Activate()


    It was the sub that i was looking for.


    Thanks again

    Franky

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width