Accessing a control for a specific record using VBA

G

Guest

I have a continuous form in which I need to set the enabled property of a
specific control depending on the value of another control in the same record.

The problem is when I set the enabled property for the control, this control
is affected for all records on the continuous form. That means that if I have
15 records on the form, this specific control becomes disabled for all 15
records on the form, where I would want only the current record's control to
be disabled.

Anyone can help me with this problem?

Thanks in advance!
 
D

Douglas J. Steele

Sorry, but that's the way Access continuous forms are: while it may look as
though you've got 15 separate text boxes, in actual fact, you've got one
text box, repeated 15 times.

However, since you can't do anything with the text box unless it's the
current row, you could always put your code that disables the box in the
form's Current event, and it would only be effective when appropriate for
the current row.
 
J

Jeff Boyce

You can consider this a ... "feature" ... of the continuous form.

Instead, change your form to a "single form", but make it look like a row of
data. Then make your overall form tall enough to display several "rows" of
data (i.e., several single forms). Now when you modify a property of a
control, it should only happen on THAT (single) form.

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
A

Albert D. Kallal

I certainly have a lot of continues forms where I set the controls 'enabled'
property on/off. While this actually makes all instances of the control go
disabled, I actually find this works quite well. I mean, when you move
to the next row, those columns that you enable, or disable can then
be set. So, you could set the controls visible property as you move
the cursor up/down through the

In fact, I actually PREFER the above behavior, as then during
data entry it is VERY easy to see that the column in question
is enabled.

In place of a VERY HARD TO READ checkerboard pattern of enabled, and
disabled boxes,
, you get a very nice enable/display view as I move the cursor up /down.

I have uploaded a gif animation of me navigating in a form, both of the two
screen shots will give you an idea of how this looks.

http://www.members.shaw.ca/AlbertKallal/HideColumn/index.htm
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top