I'm trying to enable/disable a command button, based on a check box(table
field), on a continuous form.
This form is a one-liner with only 6 items.
The weird thing is, if say 8 records(line items) are shown, changing the
check box on any one of the line items causes all buttons to respond, not
just that particular form-line.
My code is like:
Private Sub Testbutton_AfterUpdate()
If Me.chkBox = True Then
Me.cmdButton.Enabled = True
Else: Me.cmdButton.Enabled = False
End Sub
I've used this on a single form, but not continuous.
any ideas? Thanks
|
|
0
|
|
|
|
Reply
|
Stewart
|
4/13/2007 1:23:57 PM |
|
Use conditional formatting instead of code. Use the menu selection Tools-
>Conditional Formatting... for cmdButton. Set Expression Is to [chkBox]
=False and use the last button Enabled/Disabled.
Stewart wrote:
>I'm trying to enable/disable a command button, based on a check box(table
>field), on a continuous form.
>This form is a one-liner with only 6 items.
>
>The weird thing is, if say 8 records(line items) are shown, changing the
>check box on any one of the line items causes all buttons to respond, not
>just that particular form-line.
>
>My code is like:
> Private Sub Testbutton_AfterUpdate()
> If Me.chkBox = True Then
> Me.cmdButton.Enabled = True
> Else: Me.cmdButton.Enabled = False
> End Sub
>
>I've used this on a single form, but not continuous.
>any ideas? Thanks
--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/200704/1
|
|
0
|
|
|
|
Reply
|
kingston
|
4/13/2007 2:37:53 PM
|
|
I've looked in Access 2003 and 2002 but can't find conditional formatting
under Tools.
I searched help and found nothing conditional. I need more info, I'm
finding a lot in a Google search.
Thanks for the reply.
"kingston via AccessMonster.com" <u27511@uwe> wrote in message
news:70a5386ff8c74@uwe...
> Use conditional formatting instead of code. Use the menu selection Tools-
>>Conditional Formatting... for cmdButton. Set Expression Is to [chkBox]
> =False and use the last button Enabled/Disabled.
>
> Stewart wrote:
>>I'm trying to enable/disable a command button, based on a check box(table
>>field), on a continuous form.
>>This form is a one-liner with only 6 items.
>>
>>The weird thing is, if say 8 records(line items) are shown, changing the
>>check box on any one of the line items causes all buttons to respond, not
>>just that particular form-line.
>>
>>My code is like:
>> Private Sub Testbutton_AfterUpdate()
>> If Me.chkBox = True Then
>> Me.cmdButton.Enabled = True
>> Else: Me.cmdButton.Enabled = False
>> End Sub
>>
>>I've used this on a single form, but not continuous.
>>any ideas? Thanks
>
> --
> Message posted via AccessMonster.com
> http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/200704/1
>
|
|
0
|
|
|
|
Reply
|
Stewart
|
4/13/2007 3:10:11 PM
|
|
Sorry, that should have been the menu item Format, not Tools.
Stewart wrote:
>I've looked in Access 2003 and 2002 but can't find conditional formatting
>under Tools.
>
>I searched help and found nothing conditional. I need more info, I'm
>finding a lot in a Google search.
>
>Thanks for the reply.
>
>> Use conditional formatting instead of code. Use the menu selection Tools-
>>>Conditional Formatting... for cmdButton. Set Expression Is to [chkBox]
>[quoted text clipped - 17 lines]
>>>I've used this on a single form, but not continuous.
>>>any ideas? Thanks
--
Message posted via http://www.accessmonster.com
|
|
0
|
|
|
|
Reply
|
kingston
|
4/13/2007 3:25:39 PM
|
|
I found it. Its grayed out. I try to learn more.
"kingston via AccessMonster.com" <u27511@uwe> wrote in message
news:70a5a31928578@uwe...
> Sorry, that should have been the menu item Format, not Tools.
>
> Stewart wrote:
>>I've looked in Access 2003 and 2002 but can't find conditional formatting
>>under Tools.
>>
>>I searched help and found nothing conditional. I need more info, I'm
>>finding a lot in a Google search.
>>
>>Thanks for the reply.
>>
>>> Use conditional formatting instead of code. Use the menu selection
>>> Tools-
>>>>Conditional Formatting... for cmdButton. Set Expression Is to [chkBox]
>>[quoted text clipped - 17 lines]
>>>>I've used this on a single form, but not continuous.
>>>>any ideas? Thanks
>
> --
> Message posted via http://www.accessmonster.com
>
|
|
0
|
|
|
|
Reply
|
Stewart
|
4/13/2007 3:44:59 PM
|
|
Looks like conditional formatting only works with text and combo boxes, not
check boxes or command buttons.
"Stewart" <no@mailplease.com> wrote in message
news:aANTh.1$ev1.0@newsfe04.lga...
>I found it. Its grayed out. I try to learn more.
>
> "kingston via AccessMonster.com" <u27511@uwe> wrote in message
> news:70a5a31928578@uwe...
>> Sorry, that should have been the menu item Format, not Tools.
>>
>> Stewart wrote:
>>>I've looked in Access 2003 and 2002 but can't find conditional formatting
>>>under Tools.
>>>
>>>I searched help and found nothing conditional. I need more info, I'm
>>>finding a lot in a Google search.
>>>
>>>Thanks for the reply.
>>>
>>>> Use conditional formatting instead of code. Use the menu selection
>>>> Tools-
>>>>>Conditional Formatting... for cmdButton. Set Expression Is to [chkBox]
>>>[quoted text clipped - 17 lines]
>>>>>I've used this on a single form, but not continuous.
>>>>>any ideas? Thanks
>>
>> --
>> Message posted via http://www.accessmonster.com
>>
>
>
|
|
0
|
|
|
|
Reply
|
Stewart
|
4/13/2007 3:48:05 PM
|
|
You're right. I apologize again. It's been a bad day for me so far.
OK, here's a method that will work. It might not look right, but it will
work. Change your procedure to Public instead of Private. Create a
procedure for the form's OnCurrent event. Call the procedure that you just
made Public: Me.Testbutton_AfterUpdate
This will run the check and enable or disable the command button every time
the focus is moved to a record. All of the buttons will be synchronized if
you use continuous forms, but the behavior of a specific button will
correspond to that particular record. Let me know if you have any problems
with this and sorry for any confusion I've caused.
Stewart wrote:
>Looks like conditional formatting only works with text and combo boxes, not
>check boxes or command buttons.
>
>>I found it. Its grayed out. I try to learn more.
>>
>[quoted text clipped - 14 lines]
>>>>>>I've used this on a single form, but not continuous.
>>>>>>any ideas? Thanks
--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/200704/1
|
|
0
|
|
|
|
Reply
|
kingston
|
4/13/2007 4:04:52 PM
|
|
Ok
Tried that, is this what you had in mind?
Public Sub frmTestbutton_Form_Current() 'Me. caused an error
If Me.chkBox = True Then
Me.cmdButton.Enabled = True
Else: Me.cmdButton.Enabled = False
End If
End Sub
Changing one line's check box doesn't effect all other buttons, but it
doesn't enable that line's cmdButton either.
All cmdButtons stay disabled regarless of check box status. I have all set
to Enabled: No.
"kingston via AccessMonster.com" <u27511@uwe> wrote in message
news:70a5faee69ed8@uwe...
> You're right. I apologize again. It's been a bad day for me so far.
>
> OK, here's a method that will work. It might not look right, but it will
> work. Change your procedure to Public instead of Private. Create a
> procedure for the form's OnCurrent event. Call the procedure that you
just
> made Public: Me.Testbutton_AfterUpdate
> This will run the check and enable or disable the command button every
time
> the focus is moved to a record. All of the buttons will be synchronized
if
> you use continuous forms, but the behavior of a specific button will
> correspond to that particular record. Let me know if you have any
problems
> with this and sorry for any confusion I've caused.
>
> Stewart wrote:
> >Looks like conditional formatting only works with text and combo boxes,
not
> >check boxes or command buttons.
> >
> >>I found it. Its grayed out. I try to learn more.
> >>
> >[quoted text clipped - 14 lines]
> >>>>>>I've used this on a single form, but not continuous.
> >>>>>>any ideas? Thanks
>
> --
> Message posted via AccessMonster.com
> http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/200704/1
>
|
|
0
|
|
|
|
Reply
|
Stewart
|
4/13/2007 9:26:06 PM
|
|
No, what I meant was to change your existing procedure to Public. Since you
know that it works, you'd only need to call it from a different event
(OnCurrent). You still need it for the original event; you're just adding it
to another event without repeating the code. You could copy and paste the
code to the OnCurrent event, but you would continue to need it for the
checkbox's AfterUpdate event.
In short:
CheckBox AfterUpdate Event enables or disables button.
Form OnCurrent Event calls the above procedure (after it is made Public).
Stewart wrote:
>Ok
>
>Tried that, is this what you had in mind?
>
>Public Sub frmTestbutton_Form_Current() 'Me. caused an error
>If Me.chkBox = True Then
> Me.cmdButton.Enabled = True
> Else: Me.cmdButton.Enabled = False
> End If
>End Sub
>
>Changing one line's check box doesn't effect all other buttons, but it
>doesn't enable that line's cmdButton either.
>All cmdButtons stay disabled regarless of check box status. I have all set
>to Enabled: No.
>
>> You're right. I apologize again. It's been a bad day for me so far.
>>
>[quoted text clipped - 20 lines]
>> Message posted via AccessMonster.com
>> http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/200704/1
--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/200704/1
|
|
0
|
|
|
|
Reply
|
kingston
|
4/14/2007 4:59:34 AM
|
|
I was beaten.
I just left the cmdButton enabled, and found that pressing it on the desired
row would take that specific record's info to another form to do stuff, as
was suggested.
I never imagined such a simple form control, on a form, wouldn't be
dedicated/exclusive to that form. I have a lot to learn
Thanks all for your time
"kingston via AccessMonster.com" <u27511@uwe> wrote in message
news:70acbe4883468@uwe...
> No, what I meant was to change your existing procedure to Public. Since
> you
> know that it works, you'd only need to call it from a different event
> (OnCurrent). You still need it for the original event; you're just adding
> it
> to another event without repeating the code. You could copy and paste the
> code to the OnCurrent event, but you would continue to need it for the
> checkbox's AfterUpdate event.
>
> In short:
> CheckBox AfterUpdate Event enables or disables button.
> Form OnCurrent Event calls the above procedure (after it is made Public).
>
> Stewart wrote:
>>Ok
>>
>>Tried that, is this what you had in mind?
>>
>>Public Sub frmTestbutton_Form_Current() 'Me. caused an error
>>If Me.chkBox = True Then
>> Me.cmdButton.Enabled = True
>> Else: Me.cmdButton.Enabled = False
>> End If
>>End Sub
>>
>>Changing one line's check box doesn't effect all other buttons, but it
>>doesn't enable that line's cmdButton either.
>>All cmdButtons stay disabled regarless of check box status. I have all
>>set
>>to Enabled: No.
>>
>>> You're right. I apologize again. It's been a bad day for me so far.
>>>
>>[quoted text clipped - 20 lines]
>>> Message posted via AccessMonster.com
>>> http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/200704/1
>
> --
> Message posted via AccessMonster.com
> http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/200704/1
>
|
|
0
|
|
|
|
Reply
|
Stewart
|
4/15/2007 3:37:48 PM
|
|
|
9 Replies
611 Views
(page loaded in 0.093 seconds)
|