Results 1 to 6 of 6
  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

    why wouldn't a subform control show (not in the object browser, not anywhere)

    ---> this one ought to be simple, but I'm stumped...

    have a subreport: srpt_FixtSched_col1 (with a valid record source, and bound to the parent form on the fields....)


    on it is yet another subreport, and (1) unbound textbox: txtCol1_txt

    from code behind the parent form, I want to assign value to the textbox on the subform

    Code:
             Me.srpt_FixtSched_col1.Form.Controls.txtCol1_txt = strManufacturer
    "method or data member not found..."
    and indeed, when I check the object browser, it is not there
    (and I've actually checked spelling, <etc.> )

    ______
    been here before (perplexed)
    but with thanks in advance,
    mark
    Last edited by markjkubicki; 08-14-2017 at 07:25 PM. Reason: typos

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    Remove .Controls from the reference.

    Advise you name the container control different from the object it holds, like: ctrSched. Then reference the container name.

    Me.ctrSched.Form.txtCol1_txt = strManufacturer
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    markjkubicki's Avatar
    markjkubicki is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Jul 2010
    Location
    Fire Island Pines, NY
    Posts
    496
    oh!
    the sub report in a control is not the control that is containing it ...that's a new insight (how obvious - thanks!)

    so I renamed:
    the sub-report control on my main form: ctr_Col1
    the report it contains (source object): srpt_FixtSched_col1
    on that report, the control that I need to assign a value to: txtCol1_txt

    revised my code to read:
    Code:
    Me.ctr_Col1.Form.txtCol1_txt = strManufacturer
    and now I'm stuck in error 2467 (refers to an object that is closed or doesn't exist)

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    Wait, you say subreport in your OP but that the code is behind a form. So did you mean subform?

    Can't set the value of control on a report with VBA or macro.

    However, textbox ControlSource property can reference control on form. Although not if is embedded in a subform/subreport container because weird as it sounds, the subform/subreport loads before the parent object.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    markjkubicki's Avatar
    markjkubicki is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Jul 2010
    Location
    Fire Island Pines, NY
    Posts
    496
    about the report / form confusion: my error - all the comments ought to read "REPORTS"; the reference to a "FORM" is incorrect.

    curious... I have been setting the value of textboxes on REPORTS, in the detail format event, with VBA
    (the only caveat being that any fields referenced in the VBA must exist in a (hidden) control in the report detail.)

    however... I do think that your insight about the subform opening BEFORE the report may be the source of the problem (hmmmmthat is a curious sequence -oh well, MS...); and suspect that I know how to work-around that

    BIG THANKS

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    Okay, I stand corrected. Could have sworn I tried sometime in the past and it would not work. Maybe I didn't discover the requirement for the field to be in textbox on report at that time. Something I did determine later on for some calcs on the report. However, Format event only triggers in PrintPreview or direct to printer, not ReportView. I tested Load event and that works in any view.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. Replies: 2
    Last Post: 08-18-2015, 06:45 AM
  2. Web Browser Control
    By MFS in forum Programming
    Replies: 0
    Last Post: 02-28-2013, 11:08 AM
  3. Forms missing from Object Browser
    By hertfordkc in forum Access
    Replies: 1
    Last Post: 10-17-2011, 05:18 PM
  4. Web Browser Control
    By ctgann in forum Forms
    Replies: 5
    Last Post: 03-18-2011, 08:17 PM
  5. Show page on tab from control on subform
    By jpkeller55 in forum Access
    Replies: 1
    Last Post: 01-24-2011, 07:55 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