If checkbox A is blank check boxB is disabled

  • Thread starter Thread starter Jove
  • Start date Start date
J

Jove

Hello,

Can anyone help with a code so that if checkbox A is blank
check boxB is disabled?

I have NO experience with coding.

Thank YOu in Advance!!

Jove
 
-----Original Message-----
Hello,

Can anyone help with a code so that if checkbox A is blank
check boxB is disabled?

I have NO experience with coding.

Thank YOu in Advance!!

Jove
.




Reply

See Code below:

If you set the on enter event to CheckboxB to {Event
procuder] it will check if checkboxA is null if so it
will then goto CheckboxC if not it will stay in CheckboxB

You must also update on Click just in case.


Private Sub CheckboxB_Click()
If IsNull(CheckboxA.Value) Then
DoCmd.GoToControl "CheckboxC"
Exit Sub
Else
End If
End Sub

Private Sub CheckboxB_Enter()
If IsNull(CheckboxA.Value) Then
DoCmd.GoToControl "CheckboxC"
Exit Sub
Else
End If
End Sub


Regards

Ian
 
Put the following code in the AfterUpdate event of CheckboxA:

Me!CheckboxB.Enabled = Me!CheckboxA
 
If you mean how do you disable a button if checkbox A is blank then do the
same but replace the name to be the name of your button

Me!MyButton.Enabled = Me!CheckboxA

Sorry PC, hope thats what u were going to say :-)

HTH,

Neil.
 
Sorry I have a small brain,

I don't understand where to put the code and how to
identify the third variable CheckboxC cause I only have
two checkboxes in this case.

Do I put both codes into onEnter Event into checkbox1?

Please and thank you.

Joves
-----Original Message-----
-----Original Message-----
Hello,

Can anyone help with a code so that if checkbox A is blank
check boxB is disabled?

I have NO experience with coding.

Thank YOu in Advance!!

Jove
.




Reply

See Code below:

If you set the on enter event to CheckboxB to {Event
procuder] it will check if checkboxA is null if so it
will then goto CheckboxC if not it will stay in CheckboxB

You must also update on Click just in case.


Private Sub CheckboxB_Click()
If IsNull(CheckboxA.Value) Then
DoCmd.GoToControl "CheckboxC"
Exit Sub
Else
End If
End Sub

Private Sub CheckboxB_Enter()
If IsNull(CheckboxA.Value) Then
DoCmd.GoToControl "CheckboxC"
Exit Sub
Else
End If
End Sub


Regards

Ian
.
 
Sorry doesn't work...because there is no action from the
checkbox A which is also LOCKED when this form loads it
checks the TABLE to see whether there is checked or not to
decide to enable or disable checkbox b.

Please help.
Thanks Joves
 
It doesn't matter if Checkbox A is locked, it still has a value of True or
False.
 
Sorry I must be doing something wrong because it doesn't
work...I tested it there must be intervetion e.g. on
click or somethihng with Textbox A before Texbox B will
become active but there is NO intervention with texbox A
all I want it to do is check --> IF YES than enable
checkboxB.

Please and thank you.
 
Did you put this code in the form's OnCurrent event?

Me!MyButton.Enabled = Me!CheckboxA

Steve
PC Datasheet
 
Hi,

Yes I tried it on Form's OnCurrent Event I got "TYpe
Missmatch error" Runtime error 13.

Please assist.
Thanks!
 
Back
Top