Results 1 to 2 of 2
  1. #1
    markjkubicki's Avatar
    markjkubicki is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Jul 2010
    Location
    Fire Island Pines, NY
    Posts
    496

    go record on a subform with value from, and while on an unbound subform also on the main form

    on a (main) form I have an unbound subform


    I'd like to set to focus on a different (and bound) subform (on that same main form) with value from that I've gotten from the unbound subform, and while still on that unbound subform

    this is to aligned the record focus on the bound subform with info on the unbound subform
    (the bound subform is continuous, the unbound is not..)

    I have this code on the unbound subform at the 'after event' of one of its controls:

    Code:
        
    
        SrchVar = vType_initial                                                                                    'value gotten from the unbound subform
        Forms![frmSubmittal].Form![fsubSubmittal_details].SetFocus                              'main form: "frmSubmittal"; bound subform: "fsubSubmittal_details"
        Forms![frmSubmittal].Form![fsubSubmittal_details].cboType.SetFocus                 ' "cboType" is a valid type on the bound subform
        DoCmd.FindRecord SrchVar, acEntire, False, acSearchAll, False, acCurrent, True

    runtime error: 2465 cant find field 'fsubSubmittal_details'

    with many thanks in advance,
    mark
    Last edited by markjkubicki; 03-15-2017 at 12:27 PM. Reason: comments in code incorrectly identified "fsubSubmittal_details" as the unbound form; this is incorrect, it is the bound form

  2. #2
    John_G is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    Forms![frmSubmittal].Form![fsubSubmittal_details].SetFocus
    That's not the correct syntax for referring to a subform. You need to include the name of the main form control that contains the subform, and you do not use the actual name of the subform. For example, if the name of the main form control (the one containing the subform) is ctlSubForm, you could use something like this:

    Forms![frmSubmittal]!ctlSubform.Form.SetFocus

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

Similar Threads

  1. Apply Filter to Subform on Main Unbound Form
    By StuW in forum Programming
    Replies: 2
    Last Post: 10-20-2016, 10:02 AM
  2. How to filter bound subform from unbound main form?
    By ittechguy in forum Programming
    Replies: 3
    Last Post: 10-25-2015, 09:12 PM
  3. Replies: 4
    Last Post: 11-06-2014, 05:35 AM
  4. Replies: 5
    Last Post: 02-12-2014, 11:52 PM
  5. Replies: 6
    Last Post: 08-22-2012, 03:24 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