[AccessD] Set form's Caption without code

Andy Lacey andy at minstersystems.co.uk
Thu Dec 9 08:20:53 CST 2004


Brett
I get that. When we reference a control on a subform it's standard to say:

Me!subFormControl.Form!control

But I've never seen just plain [Form] used in isolation before to return the
current form object. That was a new one on me. But then it's a poor day when
you don't learn something - unless of course you're doing something more fun
than learning ;-)

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



--------- Original Message --------
From: Access Developers discussion and problem solving
<accessd at databaseadvisors.com>
To: Access Developers discussion and problem solving
<accessd at databaseadvisors.com>
Subject: RE: [AccessD] Set form's Caption without code
Date: 09/12/04 14:46

>
> Andy,
>
> Form is the default property of the form object.  If you call a
> procedure with Me or Forms!MyForm as the argument, you are actually
> saying Me.Form or Forms!MyForm.Form.
>
> I learned this one back in my Access 2 days (actually not too long ago)
> when I was writing a set of framework procedures, similar to what you
> are doing.
>
> Glad to help!
>
>
> -----Original Message-----
> From: accessd-bounces at databaseadvisors.com
> [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Andy Lacey
> Sent: Thursday, December 09, 2004 3:11 AM
> To: Access Developers discussion and problem solving
> Subject: RE: [AccessD] Set form's Caption without code
>
> You're absolutely right. Hats off to Brett. It works a treat. But where
> does that syntax come from?  I've never seen [Form] used to refer to the
> current form before, and Help doesn't have it. How'd you find that one
> Brett?
>
> --
> Andy Lacey
> http://www.minstersystems.co.uk
>
>
>
> --------- Original Message --------
> From: Access Developers discussion and problem solving
> <accessd at databaseadvisors.com>
> To: accessd at databaseadvisors.com <accessd at databaseadvisors.com>
> Subject: RE: [AccessD] Set form's Caption without code
> Date: 09/12/04 09:28
>
> >
> > 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
> >
> > &gt;&gt;&gt; andy at minstersystems.co.uk 09-12-2004
08:43:17
> > &gt;&gt;&gt; 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 &quot;settled down&quot;.
> > Gustav gave me the solution in an earler post, by either using
> > Forms(&quot;myform&quot;) or Form(Forms.Count-1).
> >
> > -- Andy Lacey
> > http://www.minstersystems.co.uk
> >
> > &gt; -----Original Message-----
> > &gt; From: accessd-bounces at databaseadvisors.com
> > &gt; [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of
&gt;
> > Brett Barabash &gt; Sent: 08 December 2004 22:10 &gt; To:
Access
> > Developers discussion and problem solving &gt; Subject: RE:
[AccessD]
> > Set form's Caption without code &gt; &gt; &gt; Andy,
&gt;
> > Screen.ActiveForm can be really picky, and I try to avoid &gt;
using
> > it if possible. Can you call it instead using the &gt; following
> > syntax:
> > &gt; =SetCaption([Form],&quot;x&quot;) &gt; &gt;
I would try placing
> > this in the On Load event.
> > &gt;
> > &gt; -----Original Message-----
> > &gt; From: accessd-bounces at databaseadvisors.com
> > &gt; [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of
Andy
> > Lacey &gt; Sent: Tuesday, December 07, 2004 4:59 AM &gt; To:
Dba &gt;
> > Subject: [AccessD] Set form's Caption without code &gt; &gt;
Ok,
> > here's the thing. I want to make a few forms lightweight &gt;
which
> > currently have just a line or two in modules. A few &gt; have
nothing
> > more than a line which dynamically sets the &gt; form's caption.
So I
> > wrote a little function like &gt; this:
> > &gt;
> > &gt; Function SetCaption(frm As Form, strCaption As String)
&gt;
> > frm.Caption = strCaption End Function &gt; &gt; and then
changed my
> > form's OnOpen from being an Event Procedure to :
> > &gt;
> > &gt; =SetCaption([Screen].[ActiveForm],&quot;x&quot;)
> > &gt;
> > &gt; (The &quot;x&quot; is just for testing. The real
call would have
> > &gt; something a bit more dynamic, like the result of a function
> > call.) &gt; &gt; The thing is that it errors because it can't
resolve
> > &gt; [Screen].[ActiveForm] at that point. Ok, methinks, I'll move
&gt;
>
> > the call. But I can't find where to put it. All of the following
> > fail:
> > &gt;
> > &gt; On Load
> > &gt; On GotFocus of the first control
> > &gt; On Current
> > &gt;
> > &gt; The only success I've had is putting a timer interval of 5
&gt;
> > and putting the call in OnTimer, but I don't like that much &gt;
as
> > you can imagine. If I force a call to it once the form's &gt; up
then
> > there's no problem (eg a command button), but that's &gt; not a
lot of
>
> > use to me either. So I know the function is &gt; fine, but has
anyone
> > got an answer as to where I might get &gt; this to run from?
> > &gt;
> > &gt; --
> > &gt; Andy Lacey
> > &gt; http://www.minstersystems.co.uk
>
>
--------------------------------------------------------------------------------------------------------------------
> The information in this email may contain confidential information that
> is legally privileged. The information is only for the use of the intended
> recipient(s) named above. If you are not the intended recipient(s), you
> are hereby notified that any disclosure, copying, distribution, or the
taking
> of any action in regard to the content of this email is strictly
prohibited.  If
> transmission is incorrect, unclear, or incomplete, please notify the
sender
> immediately. The authorized recipient(s) of this information is/are
prohibited
> from disclosing this information to any other party and is/are required to
> destroy the information after its stated need has been fulfilled.
>
> Any views expressed in this message are those of the individual
> sender, except where the sender specifies and with authority,
> states them to be the views of Tappe Construction Co.
>
> This footer also confirms that this email message has been scanned
> for the presence of computer viruses.Scanning of this message and
> addition of this footer is performed by SurfControl E-mail Filter software
> in conjunction with virus detection software.
>
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>
>
>
>
>

________________________________________________
Message sent using UebiMiau 2.7.2




More information about the AccessD mailing list