IF Statement to add a number

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

Guest

I have a text box with comments in a form that comes from a field in a table.
I want to add a 1 in a field if there is Text in the comments text box. How
do I do this? I already have a field that adds checkbox fields, but now I
need to add the comment field if there is text in it. Please help. THanks!

JC
 
In an unbound text box:
=IIf [Comments] Is Not Null, [Field1] & "1",[Field1])
This will show the field with a "1" appended. It will not store the 1, as
there is probably no reason to do so. Similarly, [Field1] + 1 if Field1 is
a number field. The calcualation will not be stored, for same reason given
above. If more information is needed, please provide more details.
 
OK. I have a table that has many YES/NO fields to keep track of a document to
see if it is complete or not. I also have a field called "Total_data", that
field is used to keep track of how many YES's there are in the plenty of
fields. That's the history of the table, now back to my originial question
that was posted.

BruceM said:
In an unbound text box:
=IIf [Comments] Is Not Null, [Field1] & "1",[Field1])
This will show the field with a "1" appended. It will not store the 1, as
there is probably no reason to do so. Similarly, [Field1] + 1 if Field1 is
a number field. The calcualation will not be stored, for same reason given
above. If more information is needed, please provide more details.

jac007 said:
I have a text box with comments in a form that comes from a field in a
table.
I want to add a 1 in a field if there is Text in the comments text box.
How
do I do this? I already have a field that adds checkbox fields, but now I
need to add the comment field if there is text in it. Please help. THanks!

JC
 
I answered it. If it does not address the question then I will need more
information about what you seek to do.

jac007 said:
OK. I have a table that has many YES/NO fields to keep track of a document
to
see if it is complete or not. I also have a field called "Total_data",
that
field is used to keep track of how many YES's there are in the plenty of
fields. That's the history of the table, now back to my originial question
that was posted.

BruceM said:
In an unbound text box:
=IIf [Comments] Is Not Null, [Field1] & "1",[Field1])
This will show the field with a "1" appended. It will not store the 1,
as
there is probably no reason to do so. Similarly, [Field1] + 1 if Field1
is
a number field. The calcualation will not be stored, for same reason
given
above. If more information is needed, please provide more details.

jac007 said:
I have a text box with comments in a form that comes from a field in a
table.
I want to add a 1 in a field if there is Text in the comments text box.
How
do I do this? I already have a field that adds checkbox fields, but now
I
need to add the comment field if there is text in it. Please help.
THanks!

JC
 
OK. I have a table that has many YES/NO fields to keep track of a document to
see if it is complete or not. I also have a field called "Total_data", that
field is used to keep track of how many YES's there are in the plenty of
fields. That's the history of the table, now back to my originial question
that was posted.

Your table structure IS WRONG.

Sorry, but the Total_Data field *should simply not exist*.

Instead, if you must store the yes/no fields (and I find that very
questionable), you can dynamically count the number of yes values
either in a Query or in a textbox on a Form. In a Query use a
calculated field:

Total_Data: Abs([field1] + [field2] + [field3] + [field4])

using your yes/no fieldnames. Yes is stored as -1, No as 0, so the sum
will be the negative of the number of Yes values; the Abs() absolute
value function will convert the -4 to 4.

John W. Vinson[MVP]
 
Back
Top