Boolean fields in reports

  • Thread starter Thread starter Andy Pryor
  • Start date Start date
A

Andy Pryor

I have a report bound to a query qryTest with field
tfTest. If I put a checkbox on the report bound to this
field I can use expressions such as:
if (me!tfTest) then.....
but if I do not do this I cannot use the field directly eg:
if ([tfTest]) then.....
Am I doing something wrong?
 
You can't reference a report's field values unless you have them bound to a
control.
 
But elsewhere I do:-

I have a database db1 with one table test having a text
field [fieldTest]

I have a form test with a label [textLabel]

I set the forms data source to test
I add this code to the form's open event

Form_Open(Cancel As Integer)
If [testField] = "Good" Then
Me![labelTest].Caption = "Pass"
Else
Me![labelTest].Caption = "Fail"
End If
End Sub

As expected the label's caption changes according the
value of the first record in test when the form is opened.

Frustratingly it also works today when I change the data
type of [FieldTest] to Yes/No which was my problem
yesterday!
-----Original Message-----
You can't reference a report's field values unless you have them bound to a
control.

--
Duane Hookom
MS Access MVP
--

I have a report bound to a query qryTest with field
tfTest. If I put a checkbox on the report bound to this
field I can use expressions such as:
if (me!tfTest) then.....
but if I do not do this I cannot use the field directly eg:
if ([tfTest]) then.....
Am I doing something wrong?


.
 
It looks like "elsewhere I do" is in a form, not a report.

--
Duane Hookom
MS Access MVP


Andy Pryor said:
But elsewhere I do:-

I have a database db1 with one table test having a text
field [fieldTest]

I have a form test with a label [textLabel]

I set the forms data source to test
I add this code to the form's open event

Form_Open(Cancel As Integer)
If [testField] = "Good" Then
Me![labelTest].Caption = "Pass"
Else
Me![labelTest].Caption = "Fail"
End If
End Sub

As expected the label's caption changes according the
value of the first record in test when the form is opened.

Frustratingly it also works today when I change the data
type of [FieldTest] to Yes/No which was my problem
yesterday!
-----Original Message-----
You can't reference a report's field values unless you have them bound to a
control.

--
Duane Hookom
MS Access MVP
--

I have a report bound to a query qryTest with field
tfTest. If I put a checkbox on the report bound to this
field I can use expressions such as:
if (me!tfTest) then.....
but if I do not do this I cannot use the field directly eg:
if ([tfTest]) then.....
Am I doing something wrong?


.
 
Back
Top