procedure and its proper place

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have lots of entry forms in a database. I would like to help the user and
make the color of the active control change so the user knows where she/he
is.
I put a procedure

Sub ChangeColor
Me.ActiveControl.BackgroundColor=xxxx

in a general modul but the word Me did confuse it.

Since I'd like to use this procedure in several forms how can I make a
reference to the active form without actially use its name?
 
If you are using a more recent version of Access (?A2000 or later), there is
a built-in function (Conditional Formatting) in the Format menu.

If you are using an earlier version, and wish to write a generic procedure,
the procedure may need to be told which form & control to modify. Your
Procedure call could have a single input parameter, the form.

When you call it, you'd pass the form, using "Me".

The following is untested aircode -- your syntax may vary:

Public Sub ChangeColor(rfrm as Form)
rfrm.ActiveControl.BackgroundColor=xxxx

and you'd call it with something like:

Call ChangeColor(Me)
 
....or screen.activeform.activecontrol...


Jeff Boyce said:
If you are using a more recent version of Access (?A2000 or later), there is
a built-in function (Conditional Formatting) in the Format menu.

If you are using an earlier version, and wish to write a generic procedure,
the procedure may need to be told which form & control to modify. Your
Procedure call could have a single input parameter, the form.

When you call it, you'd pass the form, using "Me".

The following is untested aircode -- your syntax may vary:

Public Sub ChangeColor(rfrm as Form)
rfrm.ActiveControl.BackgroundColor=xxxx

and you'd call it with something like:

Call ChangeColor(Me)

--
Good luck

Jeff Boyce
<Access MVP>
 
Back
Top