Re: forms and variables help please
- From: "Douglas J. Steele" <NOSPAM_djsteele@xxxxxxxxxxxxxxxx>
- Date: Fri, 24 Apr 2009 08:41:21 -0400
To refer to a control on the New form where the control name is a variable,
you'd use
Forms![New].Controls(variable)
If Colour is declared as a public variable in a module, you should be able
to refer to it simply as Colour, not as Dates.Colour. The only reason you'd
need to qualify with the module name is if you've got Colour declared as a
public variable in more than one module, which is not a very good practice.
Try simply using
Forms![NEW].Controls(Colour).BackColor = vbRed
Note that most of the square brackets you had are unnecessary (and, in fact,
may be incorrect)
--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)
"lee_cufc via AccessMonster.com" <u51333@uwe> wrote in message
news:9514543576382@xxxxxx
hi guys,
wondering if anyone can help with the following?
[Forms]![NEW]![(Dates.Colour)].[BackColor] = [vbRed]
In this code i'm wanting it to go to the form named 'NEW' and change the
back
color of a textbox to red.
The name of the text box is stored in the global variable 'colour', which
is
declared in the module 'dates' (hence the dates.colour part)
On stepping through my code i know that the name of the textbox is being
stored correctly in the variable im just unsure of how to use this code
with
a variable in?
Any thoughts or ideas?
thanks
Lee
--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/200904/1
.
- Follow-Ups:
- Re: forms and variables help please
- From: lee_cufc via AccessMonster.com
- Re: forms and variables help please
- References:
- forms and variables help please
- From: lee_cufc via AccessMonster.com
- forms and variables help please
- Prev by Date: Re: Conditional formatting
- Next by Date: Re: forms and variables help please
- Previous by thread: forms and variables help please
- Next by thread: Re: forms and variables help please
- Index(es):
Relevant Pages
|