[AccessD] Set form's Caption without code

Gustav Brock Gustav at cactus.dk
Thu Dec 9 03:27:07 CST 2004


Hi Brett and Andy

Well, I would say Brett's solution is the answer. 
It looks like [Form] perfectly well can be used on its own. It works
here anyway.

/gustav

>>> andy at minstersystems.co.uk 09-12-2004 08:43:17 >>>
Thanks for the reply Brett. Yes, I found that Screen.ActiveForm won't
work
at opening time. It doesn't come right until the form's "settled
down".
Gustav gave me the solution in an earler post, by either using
Forms("myform") or Form(Forms.Count-1). 

-- Andy Lacey
http://www.minstersystems.co.uk 

> -----Original Message-----
> From: accessd-bounces at databaseadvisors.com 
> [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of 
> Brett Barabash
> Sent: 08 December 2004 22:10
> To: Access Developers discussion and problem solving
> Subject: RE: [AccessD] Set form's Caption without code
> 
> 
> Andy,
> Screen.ActiveForm can be really picky, and I try to avoid 
> using it if possible. Can you call it instead using the 
> following syntax:
> =SetCaption([Form],"x") 
> 
> I would try placing this in the On Load event.
> 
> -----Original Message-----
> From: accessd-bounces at databaseadvisors.com 
> [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Andy
Lacey
> Sent: Tuesday, December 07, 2004 4:59 AM
> To: Dba
> Subject: [AccessD] Set form's Caption without code
> 
> Ok, here's the thing. I want to make a few forms lightweight 
> which currently have just a line or two in modules. A few 
> have nothing more than a line which dynamically sets the 
> form's caption. So I wrote a little function like
> this:
> 
> Function SetCaption(frm As Form, strCaption As String) 
> frm.Caption = strCaption End Function
> 
> and then changed my form's OnOpen from being an Event Procedure to :
> 
> =SetCaption([Screen].[ActiveForm],"x")
> 
> (The "x" is just for testing. The real call would have 
> something a bit more dynamic, like the result of a function call.)
> 
> The thing is that it errors because it can't resolve 
> [Screen].[ActiveForm] at that point. Ok, methinks, I'll move 
> the call. But I can't find where to put it. All of the following
fail:
> 
> On Load
> On GotFocus of the first control
> On Current
> 
> The only success I've had is putting a timer interval of 5 
> and putting the call in OnTimer, but I don't like that much 
> as you can imagine. If I force a call to it once the form's 
> up then there's no problem (eg a command button), but that's 
> not a lot of use to me either. So I know the function is 
> fine, but has anyone got an answer as to where I might get 
> this to run from?
> 
> --
> Andy Lacey
> http://www.minstersystems.co.uk 




More information about the AccessD mailing list