checkbox control array

M

mcnews

how can i make this work for checkboxes?

Dim ctl As Control
For Each ctl In Me.Controls
If ctl.ControlType = acTextBox Then ctl = Null
'If ctl.ControlType = acCheckBox Then ctl = False
Next
 
A

Arvin Meyer [MVP]

If ctl.ControlType = acCheckBox Then ctl = False

should work just fine. What error are you getting?
 
M

mcnews

If ctl.ControlType = acCheckBox Then ctl = False

should work just fine. What error are you getting?

this appears to work (4 is DefaultValue):

For Each ctl In Me.Controls
If ctl.ControlType = acTextBox Then ctl = Null
If ctl.ControlType = acCheckBox Then
If Not IsNull(ctl) Then ctl.Properties(4).Value = Null
End If
Next
 
M

mcnews

this appears to work (4 is DefaultValue):

For Each ctl In Me.Controls
If ctl.ControlType = acTextBox Then ctl = Null
If ctl.ControlType = acCheckBox Then
If Not IsNull(ctl) Then ctl.Properties(4).Value = Null
End If
Next

this works too:

If ctl.ControlType = acCheckBox Then ctl.Value = Null
 
A

Arvin Meyer [MVP]

This shouldn't make any difference:

If ctl.ControlType = acCheckBox Then ctl.Value = False
or
If ctl.ControlType = acCheckBox Then ctl = False

The value property is the default property of the check box. Null is not the
same as False. You will notice that the value of the check box in unbound
check boxes gray's out, while bound check boxes will become clear.
 
M

mcnews

This shouldn't make any difference:

If ctl.ControlType = acCheckBox Then ctl.Value = False
or
If ctl.ControlType = acCheckBox Then ctl = False

The value property is the default property of the check box. Null is not the
same as False. You will notice that the value of the check box in unbound
check boxes gray's out, while bound check boxes will become clear.

it wouldn't let me assign any value without the .value.
 

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