affect form control value with another (1 Viewer)

mhakim

Member
Local time
Today, 18:42
Joined
Jan 25, 2021
Messages
72
JV-Post-button enable.png


hi dears
good day

i wish to find code to enable and disable JV_Post Button
when check box is YES THEN JV_Post Button become enable = no
 

theDBguy

I’m here to help
Staff member
Local time
Today, 08:42
Joined
Oct 29, 2018
Messages
21,496
Have you tried the AfterUpdate event of the checkbox? If the checkbox is bound, you might also try the Current event.
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 10:42
Joined
Feb 28, 2001
Messages
27,224
Checkboxes have a Click event, an AfterUpdate event, and a LostFocus event. One of these might be a perfect place to put code such as...

Code:
Private Sub JV_GL_Transfer_LostFocus()
    JV_Post = NOT JV_GL_Transfer
End Sub

Here is the general writeup for check boxes and in it you can see links to all of the events that apply to checkboxes.

 

mhakim

Member
Local time
Today, 18:42
Joined
Jan 25, 2021
Messages
72
check box is locked it already have automatic value i will not make any manual checking
so i just want to disable the button JV-Post when the check box value is yes

in other way
main idea for user is that if the check box is yes then he donot need to click button JV-Post
 

MarkK

bit cruncher
Local time
Today, 08:42
Joined
Mar 17, 2004
Messages
8,186
Code:
Private Sub Form_Current()
'   the enabled state of the command button 
'   is the inverse of the value of the checkbox
    Me.cmdButton.Enabled = Not Me.chkBox
End Sub
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 10:42
Joined
Feb 28, 2001
Messages
27,224
If the value for the check box comes from an underlying record, MarkK's suggestion of the Current event is probably the best choice.
 

mhakim

Member
Local time
Today, 18:42
Joined
Jan 25, 2021
Messages
72
Code:
Private Sub Form_Current()
'   the enabled state of the command button
'   is the inverse of the value of the checkbox
    Me.cmdButton.Enabled = Not Me.chkBox
End Sub
very good thanks
 

Users who are viewing this thread

Top Bottom