Replacing checkbox field with "Yes" or "" (blank) text field

  • Thread starter Thread starter Jeff Kowalczyk
  • Start date Start date
J

Jeff Kowalczyk

I didn't like the way the checkbox field was printing on my report (too
big, hard to align) with text, so I want to change the output of the field
to a text control displaying "Yes" or "" (blank).

I change the control to a text box, and the results are then -1 and 0,
seemingly integers.

When using a formula in the datasource property, I am having trouble with
the boolean comparison:

[reqactive] displays -1 or 0
=IIf([reqactive],"Yes","") always displays "Yes"
=IIf([reqactive]=-1,"Yes","") gives an #Error
=IIf([reqactive]=True,"Yes","") gives an #Error

Any ideas? Thanks.
 
Jeff said:
I didn't like the way the checkbox field was printing on my report (too
big, hard to align) with text, so I want to change the output of the field
to a text control displaying "Yes" or "" (blank).

I change the control to a text box, and the results are then -1 and 0,
seemingly integers.

When using a formula in the datasource property, I am having trouble with
the boolean comparison:

[reqactive] displays -1 or 0
=IIf([reqactive],"Yes","") always displays "Yes"
=IIf([reqactive]=-1,"Yes","") gives an #Error
=IIf([reqactive]=True,"Yes","") gives an #Error


I sure looks like the reqactive value is a Text field.

If it were a real True/False field, then you would not need
an expression. You could set the text box's Format property
to Yes/No
 
Marshall said:
When using a formula in the datasource property, I am having trouble with
the boolean comparison:
[reqactive] displays -1 or 0
=IIf([reqactive],"Yes","") always displays "Yes"
=IIf([reqactive]=-1,"Yes","") gives an #Error
=IIf([reqactive]=True,"Yes","") gives an #Error

It sure looks like the reqactive value is a Text field.

If it were a real True/False field, then you would not need an expression.
You could set the text box's Format property to Yes/No

In the table definition, [reqs].[reqalert] is definitely a yes/no field.
The *control* on the report is a textbox. However, the recordsource for
this report is a query (simple, access, one join on an id field),
and that may have something to do with it. When the query is viewed in
datasheet mode, reqactive is also a checkbox.

Does that help anyone spot my error? Thanks.
 
Jeff said:
When using a formula in the datasource property, I am having trouble with
the boolean comparison:
[reqactive] displays -1 or 0
=IIf([reqactive],"Yes","") always displays "Yes"
=IIf([reqactive]=-1,"Yes","") gives an #Error
=IIf([reqactive]=True,"Yes","") gives an #Error
Marshall said:
It sure looks like the reqactive value is a Text field.

If it were a real True/False field, then you would not need an expression.
You could set the text box's Format property to Yes/No

In the table definition, [reqs].[reqalert] is definitely a yes/no field.
The *control* on the report is a textbox. However, the recordsource for
this report is a query (simple, access, one join on an id field),
and that may have something to do with it. When the query is viewed in
datasheet mode, reqactive is also a checkbox.


I don't know for sure, but it is definitely behaving as if
it were a text value. Check the table field, the query and
the text box for anything that may make Access think it's
supposed to convert it to text - Format property??
 
Jeff

The easy way would be to leave the field a CheckBox and change the report. Make the Checkbox invisible on the report and insert a TextBox in its place with a default vale of Yes. (Lets call it txtYes).

In the Detail OnPrint event put
Me.TxtYes.Visible=Me.CheckBox=Tru

This will toggle the visible state of the control based upon the value of the CheckBox

Hope this Help
Bob Rap


----- Marshall Barton wrote: ----

Jeff Kowalczyk wrote
When using a formula in the datasource property, I am having trouble wit
the boolean comparison
[reqactive] displays -1 or
=IIf([reqactive],"Yes","") always displays "Yes
=IIf([reqactive]=-1,"Yes","") gives an #Erro
=IIf([reqactive]=True,"Yes","") gives an #Erro
Marshall Barton wrote
It sure looks like the reqactive value is a Text field
If it were a real True/False field, then you would not need an expression
You could set the text box's Format property to Yes/N
In the table definition, [reqs].[reqalert] is definitely a yes/no field
The *control* on the report is a textbox. However, the recordsource fo
this report is a query (simple, access, one join on an id field)
and that may have something to do with it. When the query is viewed i
datasheet mode, reqactive is also a checkbox


I don't know for sure, but it is definitely behaving as i
it were a text value. Check the table field, the query an
the text box for anything that may make Access think it'
supposed to convert it to text - Format property?
 
Hi Jeff,

I wanted to post a quick note to see if you would like additional
assistance or information regarding this particular issue.

We appreciate your patience and look forward to hearing from you!

Sincerely yours,

Michael Cheng
Microsoft Online Support
***********************************************************
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
Please reply to newsgroups only, many thanks.
 
Back
Top