Results 1 to 5 of 5
  1. #1
    glen is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jul 2012
    Posts
    171

    How to move focus from sub to main form?

    Hello,
    I have a main form with sub form.
    there is one combo1 in main form.
    in sub form there is a control named orderdate.



    i put in sub form before update event this code but this is not move the focus on combo1.
    Plz tell me where is problem.
    thanks
    Code:
    If Len(forms!main.combo1 & vbNullString) = 0 Then
      MsgBox "select combo1 first"
      Cancel = True
      forms!main.combo1.setfocus
    End If

  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
    I suspect that since you've cancelled the subform's update, focus can't move from it. Why would you test a main form field from the subform? I would think you'd check it in the main form's event.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    glen is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jul 2012
    Posts
    171
    yes from Main form event this code is working.But I want to move from sub form.
    I also studied this table but didn't get.
    http://access.mvps.org/access/forms/frm0031.htm

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    But by cancelling the update you're telling Access you don't want focus to leave the subform.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    glen is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jul 2012
    Posts
    171
    if possible suggest some other code for me according my need.
    But from sub form, not from main form.
    if not possible then thanks.

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

Similar Threads

  1. Requery Main Form, Keep Focus on Subform
    By burrina in forum Forms
    Replies: 8
    Last Post: 11-21-2012, 03:50 AM
  2. Move Focus From Subform To Main Form
    By burrina in forum Forms
    Replies: 2
    Last Post: 11-18-2012, 03:09 AM
  3. Replies: 3
    Last Post: 10-09-2012, 11:58 PM
  4. Replies: 1
    Last Post: 02-29-2012, 09:38 AM
  5. Replies: 11
    Last Post: 01-26-2012, 01:22 PM

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