Simple Question

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
 
S

Sandra Daigle

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
 
R

Reggie

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
 
S

Sandra Daigle

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
 
R

Reggie

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top