Full Version: Referencing a control in an array manner
UtterAccess Discussion Forums > Microsoft® Access > Access Forms
rdemyan
I have nine rectangles on a form. Currently they are invisible, transparent and the backcolor isn't correct.

The box names are Box1, Box2, Box3, Box4 and so on.

The following code doesn't seem to have the desired effect, but is having some effect as I'll describe below.

Me("Box" & k).Visible = True
Me("Box" & k).BackStyle = Normal
Me("Box" & k).BackColor = 13684944

k is the number of the box that is to be effected by the code.

As a test, in design mode I have made Box1 visible so that it covers up a part of the form (which covering up is clearly visible on the form) and commented out the above code. Running the code displays a form where Box1 clearly covers up part of the form. This is as expected.

However, if I now uncomment-out the code, the box is no longer visible. How can that be since the code is supposed to cause it be visible and set the backstyle to non-transparent and then set the desired backcolor.

I'm not getting any code errors and the code is having an effect which appears to be the opposite of what is desired.

Thanks for any help.


Edited by: rdemyan on Sun Dec 25 18:39:44 EST 2005.
rdemyan
I guess I found the answer. It appears that the line:

Me("Box" & k).BackStyle = Normal

is causing the problem. Removing just this line out results in the desired effect.

No need to respond further.
R. Hicks
What you have should work ...
Are you setting the k value based on the evaluation of something such as a condition ???

Can you post an example of this form along with more details about the k value ???

RDH
R. Hicks
I posted my reply as you were making this one ...
Glad you found the solution ...

RDH
gromit
Make sure that you have declared Normal as a variable and set it s value to 1.

- g
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.