Accessing Controls in the Form Detail Line

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

Guest

Hi All,
Been trying all morning on this...

I have bound controls in a detail line. I need to enable/disable a command
button, based on the value of a field next to it. Whenever I change the value
of the command button, it changes all the buttons of that name. I thought
that there would be a reference to the command button via control array, but
I can't find it.

I know what record I'm on(row), but I can't seem to find a way to reference
only the controls on that line.

thanks
 
Hi Stuart,

Unfortunately, there really isn't a good way to do this. Any modification to
the properties of a control (including command buttons in the detail
section) will be apparent on all rows of a continuous subform since there is
just one control - just multiple copies of the control are displayed.
Conditional Formatting allows more flexibility for many controls but
conditional formatting is not available for command buttons.
 
Stuart said:
I have bound controls in a detail line. I need to enable/disable a command
button, based on the value of a field next to it. Whenever I change the value
of the command button, it changes all the buttons of that name. I thought
that there would be a reference to the command button via control array, but
I can't find it.

I know what record I'm on(row), but I can't seem to find a way to reference
only the controls on that line.


Apparently, you're using a continuous form, in which case,
you can not set control properties in an event procedure
without affecting each instance of the control. I.e. there
is only one control being displayed multiple times.

A somwhat hokey way to acheve this effect is to use a locked
text box instead of the button. You can make the text box
look a lot like a button and you can use Conditional
Formatting to enable/disable it.

My normal approach to this issue is to move the button to
the form header or footer section and use the Current event
(along with your AfterUpdate event) to enable/disable the
button.
 
Hi Sandra,

That's what I was thinking. I know there's a way to get to it via the API,
but I'm not sure it's worth the trouble.

thanks

Sandra Daigle said:
Hi Stuart,

Unfortunately, there really isn't a good way to do this. Any modification to
the properties of a control (including command buttons in the detail
section) will be apparent on all rows of a continuous subform since there is
just one control - just multiple copies of the control are displayed.
Conditional Formatting allows more flexibility for many controls but
conditional formatting is not available for command buttons.

--
Sandra Daigle [Microsoft Access MVP]
Please post all replies to the newsgroup.

Hi All,
Been trying all morning on this...

I have bound controls in a detail line. I need to enable/disable a
command button, based on the value of a field next to it. Whenever I
change the value of the command button, it changes all the buttons of
that name. I thought that there would be a reference to the command
button via control array, but I can't find it.

I know what record I'm on(row), but I can't seem to find a way to
reference only the controls on that line.

thanks
 
Hey Marshal,

Thanks, I tried the CF way, but that's not going to get it in this case.
Same with the header/footer.

Thanks, though.
 
Added some code to disable the button on Current event. If the user doesn't
click on the button that was enabled for that detail line, Current turns it
off before the wrong button can process the click event. Not perfect, but end
result is as needed.

thanks
 
Added some code to disable the button on Current event. If the user
doesn't
click on the button that was enabled for that detail line, Current turns
it
off before the wrong button can process the click event. Not perfect, but
end
result is as needed.

I have a good deal of continues forms that does the above. It actually is
not too bad..as the person navigates..and a particular control/field gets
disabled..the whole column turns grey. Actually, it is kind of a nice visual
cue once you get used of it. I find this better this just the ONE control
being enabled and the one below being dis-abled.

Anway, I find the visual cue of the whole collum being disabled is a much
larger visual effect, and in fact I come to like it.
 
Back
Top