On enter check a textbox1 and if checked enable texbox2

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

Jove

Hello experts,

First like to thank PC Datasheet for helping me up to now.

I have next to no knowledge of VB coding or any coding, I
can't seem to make this work.

Can anyone help with coding, I have a form and on enter of
it checks to see if the checkbox named SupCheckbox is null
or not if it has a checkmark than it should enable the
checkbox named BudCheckbox, currently BudCheckbox is
disabled.

I tried the following code on Form's OnCurrent Event I got
error 13.

Me!SupCheckbox.Enabled = Me!BudCheckbox

Sorry if you can please provide details as where and which
Event to best place the code?

Thank YOu in Advance!!

Jove
 
HI JOVE!!

Now, before you past this code in your application, keep
in mind that Your 'SupCheckbox' has to be linked to a field
('Yes/No') of a table, otherwise, whenever you open or
close, thenre-open, your checkbox will always have a null
value.
So if your linked to a field inside a table then the
following code,placed inside the 'Current' event should
work find:

If IsNull(SupCheckbox.Value) Then
' skip
Else
BudCheckbox.Enabled = True

End If

The 'Current' event allows you to check if your checkbox
is null or not for every record entered,so far, in that
table.

Hope this helps,
PAtrick
 
Hi Patrick,

Thanks for the info...yes both checkboxes are linked to
the same table. But I do I have to set the BudAnalyst to
Disable?

I tried both methods and can't seem to get it to work I
put your code in the Current Event at the FoRM level...

Did I do something wrong?

Jove
 
Jove said:
I have next to no knowledge of VB coding or any coding, I
can't seem to make this work.

Can anyone help with coding, I have a form and on enter of
it checks to see if the checkbox named SupCheckbox is null
or not if it has a checkmark than it should enable the
checkbox named BudCheckbox, currently BudCheckbox is
disabled.

I tried the following code on Form's OnCurrent Event I got
error 13.

Me!SupCheckbox.Enabled = Me!BudCheckbox

Sorry if you can please provide details as where and which
Event to best place the code?


As PAtrick said, use the Current event, but the checks for
Null can be simplified a little. Try this:

Me!BudCheckbox.Enabled = Nz(Me!SupCheckbox, False)
 
Is the budAnalyst another checkbox!!!
I'm not sure but in any case, check the properties
of 'BudAnalyst'(right-click on 'budAnalyst' and select
properties. after select the data tab. Check if enabled is
set to false. if not change-it..

Also change the code I gave ya to this(in the current
event)

If SupChk.Value = True Then
BudCheckbox.Enabled = False
ElseIf SupChk.Value = False Then
BudCheckbox.Enabled = True
End If


I've just tested-it it should work ....

HTH,
PAtrick
 
Hi Patrick
I will try it but yes they are both checkboxes all joined
to a table.
I will let you know how it goes after my lunch break.

THANKS a BILLION again.
Jove
 
Back
Top