Consulting

Results 1 to 8 of 8

Thread: Solved: setting .text in Report_Open

  1. #1
    VBAX Tutor TheAntiGates's Avatar
    Joined
    Feb 2005
    Location
    Tejas
    Posts
    263
    Location

    Solved: setting .text in Report_Open

    Does anyone know the trick here, for a textbox control? (A2003)

    If I attempt to set .Value: "You can't assign a value to this object"
    If I attempt to set .Text: "You can't reference a property or method for a control unless the control has the focus"
    If I attempt to .SetFocus: "Microsoft Access doesn't allow you to use this method in the current view."
    If I try to set the string in .ControlSource, it attempts to find an object with that name. True, this impels an InputBox to appear for typing in the desired value, but I don't want the user to type anything; the code should stuff the textbox content.

    All these make sense; is there some other trick for this?
    I just found a cool semi-advanced VBA page - dictionary, queue, etc. http://analystcave.com/excel-vba-dic...ta-structures/

  2. #2
    VBAX Newbie
    Joined
    Jan 2005
    Posts
    1
    Location
    you can do many more things in report events using:

    On Fomart
    sortdata

  3. #3
    VBAX Guru
    Joined
    Mar 2005
    Posts
    3,296
    Location
    To add to what sordata has said you need to use the report's "Detail" Event Procedure "on format" to control field attributes.

  4. #4
    VBAX Tutor TheAntiGates's Avatar
    Joined
    Feb 2005
    Location
    Tejas
    Posts
    263
    Location
    Thanks for the nondrunk of the responses. But what if the textbox is not in the detail section? I'm interested in seeding a textbox in the report header. That's why the thread subject is what it is. (Or are you saying that the thread's subject is impossible?)

    Unless!: Is there an event like OnHeader or OnReportHeader? I don't think so, but for anyone knowledgeable: can you point me to a list of each Report Event with the sequence of evaluation? I've seen it in more than one place but it's not Googling for me now.
    I just found a cool semi-advanced VBA page - dictionary, queue, etc. http://analystcave.com/excel-vba-dic...ta-structures/

  5. #5
    VBAX Guru
    Joined
    Mar 2005
    Posts
    3,296
    Location
    You can also use the Report Header bar's On Format event procedure, I just made a "Label" Invisible on format.

  6. #6
    VBAX Tutor TheAntiGates's Avatar
    Joined
    Feb 2005
    Location
    Tejas
    Posts
    263
    Location
    Thanks for leading me to ReportHeader_Format, though it has the identical problems mentioned atop here.

    In researching this I'm finding all kinds of report properties (e.g. Retreat, Page, Error, NoData); all I need now is a master list of the sequence of firing. One interesting piece is (a/c what I read) that _Open occurs before the query is run.

    ReportHeader_Format presumably fires later then Report_Open. So it had a better chance of doing what I want. Hopefully a sequenced list will let me incrementally test to find when .text is first broachable ... and hopefully, that will be before the report header has printed.

    One source gave this:

    Open(Report)
    Activate(Report)

    Format(Report Section)
    Print(Report Section)

    Close(Report)
    Deactivate(Report)
    I just found a cool semi-advanced VBA page - dictionary, queue, etc. http://analystcave.com/excel-vba-dic...ta-structures/

  7. #7
    VBAX Guru
    Joined
    Mar 2005
    Posts
    3,296
    Location
    What exactly do you want to do with the textbox?

  8. #8
    VBAX Tutor TheAntiGates's Avatar
    Joined
    Feb 2005
    Location
    Tejas
    Posts
    263
    Location
    The order of events is in the Access help file. I'll figure it out from there.
    I just found a cool semi-advanced VBA page - dictionary, queue, etc. http://analystcave.com/excel-vba-dic...ta-structures/

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •