View Full Version : Solved: setting .text in Report_Open
TheAntiGates
04-19-2005, 11:11 AM
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?
sordata
04-20-2005, 01:08 PM
you can do many more things in report events using:
On Fomart
To add to what sordata has said you need to use the report's "Detail" Event Procedure "on format" to control field attributes.
TheAntiGates
04-21-2005, 12:42 PM
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.
You can also use the Report Header bar's On Format event procedure, I just made a "Label" Invisible on format.
TheAntiGates
04-21-2005, 03:37 PM
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)
What exactly do you want to do with the textbox?
TheAntiGates
04-22-2005, 09:01 AM
The order of events is in the Access help file. I'll figure it out from there.
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.