Results 1 to 3 of 3
  1. #1
    fluppe is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2014
    Posts
    48

    cant assign recordsource or recordset to a subform within a tab control

    Hi everybody, i have the following problem ...


    Code:
    
    DoCmd.OpenForm "EDIT_BCs_SepSysIDs", acDesign
    
    Set ctl = Forms!EDIT_BCs_SepSysIDs.Form!TabCtl14
    
    
    For ind = 1 To num
        
        str = Replace("SegID_[ind]", "[ind]", CStr(ind))
    
        Set pa = ctl.Pages.Add
    
        pa.Name = str
        SQLstr = "SELECT dummystuff FROM dummytbl"
        
        '
        ' add a subform to the page ...
        '
        
        Set page_sub = CreateControl("EDIT_BCs_SepSysIDs", acSubform, acDetail, str, "", 500, 1000, 6000, 4000)
        page_sub.Name = "seg_sub_" & CStr(ind)
        
        Set qry = CurrentDb.CreateQueryDef("", SQLstr)
        Set tbl = qry.OpenRecordset
        pa.Enabled = True
        
        'Open page sub ? HOW ? -> ERROR
        Set page_sub.Form.Recordset = tbl
        
    
    Next ind

    well, it works so far as intended, but i can't assign the Recordset.
    It seems to be the same with the Recordsource, so, what can i do ? It seems i can't refer to the "page_sub.Form" because it does not exist.
    It would be an option for me to assign a Form as "Content" of the "page_sub"-Control, and maybe that is what i have to do anyway, but i don't know how (?)

    I appreciate the kindness of reading this post with interest and really would be very thankful for all sorts of suggestions.

    Best regards,

    ...

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,549
    on tab.change event

    set the form.subform.sourceobject
    or
    if the same subform, change the recordset

  3. #3
    fluppe is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2014
    Posts
    48
    Hi,
    thanks for the answer. Currently, i don't know what is meant by " on tab.change event " ... but i think i know what is meant by setting the "sourceobject" ... gonna try that. Thanks a lot and

    best regards,
    ....

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

Similar Threads

  1. Replies: 2
    Last Post: 10-30-2014, 06:45 AM
  2. Tab Control and Recordsource
    By gmaster in forum Forms
    Replies: 2
    Last Post: 05-30-2014, 07:18 PM
  3. Replies: 12
    Last Post: 05-30-2013, 02:02 PM
  4. To get SQL of loaded recordset (not recordsource)
    By mercapto in forum Programming
    Replies: 2
    Last Post: 12-12-2012, 10:32 AM
  5. Replies: 3
    Last Post: 03-28-2012, 10:16 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