|
 |
access thread: Differentiating controls on a continuous form
Message #1 by "Haslett, Andrew" <andrew.haslett@i...> on Thu, 18 Apr 2002 11:22:57 +0930
|
|
Greetings all.
I have a continuous form with a combo box and command button on each record.
Depending on value selected in the combo box, I'd like to enable/disable the
command button for each record.
I have an on_change event for the combo box which works correctly however
the changes to the command button apply to ALL records since it has the same
name. How can I differentiate between each record?
I thought about 'dynamically' naming each command button, but for any
command button events I'd need to create a separate entry for each name..
Is there some type of index I can refer to, such as me.cmdOpenForm(i)
Enabled where i relates to that particular record?
Stumped..
Andrew
Message #2 by "Phillip Johnson" <phillip.johnson@e...> on Thu, 18 Apr 2002 08:53:41
|
|
Try the Access.controls.item(index).
you can get the type of the control using a procedure called TypeOf
(control).
You can cycle through each control in the collection by using:
Dim ctl as control
For each ctl in controls
(code here)
next ctl
Hope this helps,
Kind regards,
Phillip
> Greetings all.
I have a continuous form with a combo box and command button on each
record.
Depending on value selected in the combo box, I'd like to enable/disable
the
command button for each record.
I have an on_change event for the combo box which works correctly however
the changes to the command button apply to ALL records since it has the
same
name. How can I differentiate between each record?
I thought about 'dynamically' naming each command button, but for any
command button events I'd need to create a separate entry for each name..
Is there some type of index I can refer to, such as me.cmdOpenForm(i)
Enabled where i relates to that particular record?
Stumped..
Andrew
Message #3 by "David Chapman" <luckychap@b...> on Thu, 18 Apr 2002 19:42:28 +0930
|
|
I don't believe it can be done using a command button. You can design a text
box to look like a command button (mine are better). The text box can have
a control source - an unbound textbox will behave the same as a command
button on contiuous forms. The record source of the form (a query) can have
a dummy field to be the control source of the text box but the point is you
can manipulate its value in code. Enabling and disabling effect would have
to be achieved in logic - ie the on click event would have to test a
condition before executing something.
There is also a MS Knowledge Base artical on how to change colours of
controls on continous forms, but that may not be necessary to your project.
David
-----Original Message-----
From: Haslett, Andrew [mailto:andrew.haslett@i...]
Sent: Thursday, April 18, 2002 11:23 AM
To: Access
Subject: [access] Differentiating controls on a continuous form
Greetings all.
I have a continuous form with a combo box and command button on each record.
Depending on value selected in the combo box, I'd like to enable/disable the
command button for each record.
I have an on_change event for the combo box which works correctly however
the changes to the command button apply to ALL records since it has the same
name. How can I differentiate between each record?
I thought about 'dynamically' naming each command button, but for any
command button events I'd need to create a separate entry for each name..
Is there some type of index I can refer to, such as me.cmdOpenForm(i)
Enabled where i relates to that particular record?
Stumped..
Andrew
|
|
 |