By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,998 Members | 2,871 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,998 IT Pros & Developers. It's quick & easy.

If Statement with multiple controls

P: n/a
jpr
Hello,

I have a form with multiple controls (textboxes) named:
Father
Mother
Child1
Child2

On the form there are also two checkboxes (check1 and check2).

I am using the following statement for each control and placed in in
the OnCurrent event of my form:
If Not IsNull (Me.Fater) Then
Me.Check1 = "YES" (or -1)
Me.Check2.Value = False
End IF

Is there a way I can write one If statement saying:
If all controls Father, Mather, Child1 and Child2 or at least one of
them has data, then Check1 should be selected and check2 emply. If all
controls do not have data then ckeck1 should be empty and check2
selected.

Thank you.

Jul 14 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
do you mean something along the lines (vb.net):

Check1.checked = Father.text.trim <string.empty orelse ...
Child2.text.trim <string.empty
Check2.checked = not Check1.checked

-tom

jpr ha scritto:
Hello,

I have a form with multiple controls (textboxes) named:
Father
Mother
Child1
Child2

On the form there are also two checkboxes (check1 and check2).

I am using the following statement for each control and placed in in
the OnCurrent event of my form:
If Not IsNull (Me.Fater) Then
Me.Check1 = "YES" (or -1)
Me.Check2.Value = False
End IF

Is there a way I can write one If statement saying:
If all controls Father, Mather, Child1 and Child2 or at least one of
them has data, then Check1 should be selected and check2 emply. If all
controls do not have data then ckeck1 should be empty and check2
selected.

Thank you.
Jul 14 '06 #2

P: n/a
On 14 Jul 2006 00:45:08 -0700, "jpr" <jp***@tin.itwrote:
>Hello,

I have a form with multiple controls (textboxes) named:
Father
Mother
Child1
Child2

On the form there are also two checkboxes (check1 and check2).

I am using the following statement for each control and placed in in
the OnCurrent event of my form:
If Not IsNull (Me.Fater) Then
Me.Check1 = "YES" (or -1)
Me.Check2.Value = False
End IF

Is there a way I can write one If statement saying:
If all controls Father, Mather, Child1 and Child2 or at least one of
them has data, then Check1 should be selected and check2 emply. If all
controls do not have data then ckeck1 should be empty and check2
selected.

Thank you.
Me.Check1 = Len(Trim(Me.Father) & Trim(Me.Mother) & Trim(Me.Child1) &
Trim(Me.Child2))>0

Me.Check2 = Not Me.Check1
Wayne Gillespie
Gosford NSW Australia
Jul 15 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.