Simple Question

  • Thread starter Thread starter Chris
  • Start date Start date
C

Chris

I am trying to enable 3 text boxes when a check box is ticked. I can get
one text box to enable and disable when the tick box is clicked. I have
tried the method

IF chkbox .value = -1 Then
txtBox1.enabled = True And txtBox2.enabled = true
Else txtBox1.enabled = false And txtBox.enabled = False
End If
 
Hi Chris,

And is a logical operator - it only returns true or false based on the
logical outcome of Anding two (or more) values.

You need multiple assignment statements:

IF chkbox .value = -1 Then
txtBox1.enabled = True
txtBox2.enabled = true
else
txtBox1.enabled = false
txtBox.enabled = False
End If
 
Or
Me.txtBox1.Enabled = Me.chkBox
Me.txtBox2.Enabled = Me.chkBox

--
Reggie

----------
Sandra Daigle said:
Hi Chris,

And is a logical operator - it only returns true or false based on the
logical outcome of Anding two (or more) values.

You need multiple assignment statements:

IF chkbox .value = -1 Then
txtBox1.enabled = True
txtBox2.enabled = true
else
txtBox1.enabled = false
txtBox.enabled = False
End If

--
Sandra Daigle
[Microsoft Access MVP]
For the benefit of others please post all replies to this newsgroup.
I am trying to enable 3 text boxes when a check box is ticked. I can get
one text box to enable and disable when the tick box is clicked. I have
tried the method

IF chkbox .value = -1 Then
txtBox1.enabled = True And txtBox2.enabled = true
Else txtBox1.enabled = false And txtBox.enabled = False
End If
 
Exactly - that's how I'd typically do it (would have recommened it myself
but I hadn't had my morning coffee yet!).

--
Sandra Daigle [Microsoft Access MVP]
Please post all replies to the newsgroup.

Or
Me.txtBox1.Enabled = Me.chkBox
Me.txtBox2.Enabled = Me.chkBox


----------
Sandra Daigle said:
Hi Chris,

And is a logical operator - it only returns true or false based on
the logical outcome of Anding two (or more) values.

You need multiple assignment statements:

IF chkbox .value = -1 Then
txtBox1.enabled = True
txtBox2.enabled = true
else
txtBox1.enabled = false
txtBox.enabled = False
End If

--
Sandra Daigle
[Microsoft Access MVP]
For the benefit of others please post all replies to this newsgroup.
I am trying to enable 3 text boxes when a check box is ticked. I
can get one text box to enable and disable when the tick box is
clicked. I have tried the method

IF chkbox .value = -1 Then
txtBox1.enabled = True And txtBox2.enabled = true
Else txtBox1.enabled = false And txtBox.enabled = False
End If
 
I know the feeling;-)
--
Reggie

----------
Sandra Daigle said:
Exactly - that's how I'd typically do it (would have recommened it myself
but I hadn't had my morning coffee yet!).

--
Sandra Daigle [Microsoft Access MVP]
Please post all replies to the newsgroup.

Or
Me.txtBox1.Enabled = Me.chkBox
Me.txtBox2.Enabled = Me.chkBox


----------
Sandra Daigle said:
Hi Chris,

And is a logical operator - it only returns true or false based on
the logical outcome of Anding two (or more) values.

You need multiple assignment statements:

IF chkbox .value = -1 Then
txtBox1.enabled = True
txtBox2.enabled = true
else
txtBox1.enabled = false
txtBox.enabled = False
End If

--
Sandra Daigle
[Microsoft Access MVP]
For the benefit of others please post all replies to this newsgroup.

Chris wrote:
I am trying to enable 3 text boxes when a check box is ticked. I
can get one text box to enable and disable when the tick box is
clicked. I have tried the method

IF chkbox .value = -1 Then
txtBox1.enabled = True And txtBox2.enabled = true
Else txtBox1.enabled = false And txtBox.enabled = False
End If
 
Back
Top