Results 1 to 3 of 3
  1. #1
    asmith78 is offline Novice
    Windows 7 32bit Access 2003
    Join Date
    Aug 2011
    Posts
    15

    Setting Focus to Field on Continuous Subform


    OK, so I have a subform and I want to set focus to a combo box on the subform after lost focus of the combo box field. I need for the user to make a selection from the combo box before moving on. I am placing the code on the LostFocus event procedure of the subform and it works as far as giving me my message but it WILL NOT set focus back to that field no matter what I try. Here is my coding and I am also providing screen shots.

    Private Sub defWC_LostFocus()
    If (IsNull(defWC) And Len(defAttCode)) > 0 Then
    MsgBox "Please enter Who Committed the error.", vbOKOnly, "Validation"
    Me.defWC.SetFocus
    Exit Sub
    End If
    End Sub

    Any assistance is GREATLY appreciated.

    Thanks,
    Amy

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Personally I do that type of thing in the before update event of the form, but if you want it there I think you need to set focus somewhere else and then back on the the control you're on.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    asmith78 is offline Novice
    Windows 7 32bit Access 2003
    Join Date
    Aug 2011
    Posts
    15
    Hmm, okay now that I set focus to another field and back to the defWC field that is working but only if they click within the subform. If they click back to form and try assigning another error it doesn't give them the error message. Therefore, I put the code on the LostFocus of the actual subform and it doesn't seem to produce the message box either.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. HELP! Set Focus to Continuous Sub Form Field
    By asmith78 in forum Programming
    Replies: 1
    Last Post: 09-09-2011, 02:27 PM
  2. Setting focus on a tabbed form
    By crowegreg in forum Forms
    Replies: 21
    Last Post: 08-27-2011, 09:22 AM
  3. Set focus to a field on a subform
    By MiaAccess in forum Forms
    Replies: 11
    Last Post: 03-05-2011, 11:49 AM
  4. Replies: 15
    Last Post: 11-09-2010, 04:27 PM
  5. Setting Focus on a Form
    By MFeightner in forum Forms
    Replies: 1
    Last Post: 07-30-2009, 07:49 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums