Control checking

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How would I check to see if a check box is checked or not? I tried the following

me.control.value = ye

but did not seem to work

Thanks in advance.
 
If the name of the checkbox is myChk then, the full syntax
is Me.myChhk.Value = True and the short syntax is myChk = True

The shorthand notation that you would tend to see in If
tests is
If myChk Then

Hope This Helps
Gerald Stanley MCSD
 
I can't seem to find the errors in my code here, but it doesn't seem to disable when there is no check in the box for that record

Private Sub Form_Current(

If Me.IRStatus_cbo = "Closed" The
Me.IRFinDateTime_txt.Locked = Fals
ElseIf Me.SystemDwnTime_chk.Value = True The
Me.Create_Outage_cmd.Enabled = Tru

Else: Me.IRFinDateTime_txt.Locked = True And Me.Create_Outage_cmd.Enabled = Fals

End I

End Sub
 
Try

If Me.IRStatus_cbo = "Closed" Then
Me.IRFinDateTime_txt.Locked = False
ElseIf Me.SystemDwnTime_chk.Value = True Then
Me.Create_Outage_cmd.Enabled = True
Else
Me.IRFinDateTime_txt.Locked = True
Me.Create_Outage_cmd.Enabled = False
End If

You may also want to consider putting code into the first
element for Me.Create_Outage_cmd and into the second
element for Me.IRFinDateTime_txt.

Hope This Helps
Gerald Stanley MCSD
-----Original Message-----
I can't seem to find the errors in my code here, but it
doesn't seem to disable when there is no check in the box
for that record.
Private Sub Form_Current()

If Me.IRStatus_cbo = "Closed" Then
Me.IRFinDateTime_txt.Locked = False
ElseIf Me.SystemDwnTime_chk.Value = True Then
Me.Create_Outage_cmd.Enabled = True

Else: Me.IRFinDateTime_txt.Locked = True And
Me.Create_Outage_cmd.Enabled = False
 
Your statement

Else: Me.IRFinDateTime_txt.Locked = True And
Me.Create_Outage_cmd.Enabled = False

will cause Me.IRFinDateTime_txt.Locked to be set to

(True And Me.Create_Outage_cmd.Enabled = False)

This is probably not what you want. Try:

Else
Me.IRFinDateTime_txt.Locked = True
Me.Create_Outage_cmd.Enabled = False
End If

Thanks,
Mattias Jonsson

Derek said:
I can't seem to find the errors in my code here, but it doesn't seem to
disable when there is no check in the box for that record.
Private Sub Form_Current()

If Me.IRStatus_cbo = "Closed" Then
Me.IRFinDateTime_txt.Locked = False
ElseIf Me.SystemDwnTime_chk.Value = True Then
Me.Create_Outage_cmd.Enabled = True

Else: Me.IRFinDateTime_txt.Locked = True And
Me.Create_Outage_cmd.Enabled = False
 
Back
Top