check if value exists to determine lable's visability

M

Mark Kubicki

I want to check if a YES value exists for the field [Flaged] (data type:
yes/no) anywhere in the table "tblProjectSchedule", which is data source for
the report.
Then, if so, display a label (lblFlaged) in the footer.

To do this, I entered this code which produced an error: "you cancelled the
previous operation"
(I may simply have it in the wrong section, but have not been able to tell
which is the correct one... any suggestions would be greatly appreciated...


Private Sub ReportFooter_Format(Cancel As Integer, FormatCount As Integer)
varX = DLookup("[Flaged]", "tblProjectSchedule", "[Flaged] = vbTrue")
me.lblFlaged.visible = varX
End Sub


as always, thanks in advance,
mark
 
D

Duane Hookom

I wouldn't use any code. Try use a text box with a control source like:
=IIf(DCount("*", "tblProjectSchedule", "[Flaged] = True"),"value to
display",Null)

You may be able to use a more efficient expression:
=IIf(Min([Flaged])=-1,"value to display",Null)
 
M

Mark Kubicki

our value to display is " '?' denotesd that item has been revised..."
and entering the " ?" into the text box's properties seems to wreak havok
and crash the report (I have to go back to a back-up to get a working
copy...)

i tried this with the second expression you provided below...

again, thanks in advance,
mark
-------------------------------------------
Duane Hookom said:
I wouldn't use any code. Try use a text box with a control source like:
=IIf(DCount("*", "tblProjectSchedule", "[Flaged] = True"),"value to
display",Null)

You may be able to use a more efficient expression:
=IIf(Min([Flaged])=-1,"value to display",Null)

--
Duane Hookom
Microsoft Access MVP


Mark Kubicki said:
I want to check if a YES value exists for the field [Flaged] (data type:
yes/no) anywhere in the table "tblProjectSchedule", which is data source
for
the report.
Then, if so, display a label (lblFlaged) in the footer.

To do this, I entered this code which produced an error: "you cancelled
the
previous operation"
(I may simply have it in the wrong section, but have not been able to
tell
which is the correct one... any suggestions would be greatly
appreciated...


Private Sub ReportFooter_Format(Cancel As Integer, FormatCount As
Integer)
varX = DLookup("[Flaged]", "tblProjectSchedule", "[Flaged] = vbTrue")
me.lblFlaged.visible = varX
End Sub


as always, thanks in advance,
mark
 
D

Duane Hookom

What section of the report did you place the text box into? What was the
exact control source.

--
Duane Hookom
Microsoft Access MVP


Mark Kubicki said:
our value to display is " '?' denotesd that item has been revised..."
and entering the " ?" into the text box's properties seems to wreak havok
and crash the report (I have to go back to a back-up to get a working
copy...)

i tried this with the second expression you provided below...

again, thanks in advance,
mark
-------------------------------------------
Duane Hookom said:
I wouldn't use any code. Try use a text box with a control source like:
=IIf(DCount("*", "tblProjectSchedule", "[Flaged] = True"),"value to
display",Null)

You may be able to use a more efficient expression:
=IIf(Min([Flaged])=-1,"value to display",Null)

--
Duane Hookom
Microsoft Access MVP


Mark Kubicki said:
I want to check if a YES value exists for the field [Flaged] (data type:
yes/no) anywhere in the table "tblProjectSchedule", which is data source
for
the report.
Then, if so, display a label (lblFlaged) in the footer.

To do this, I entered this code which produced an error: "you cancelled
the
previous operation"
(I may simply have it in the wrong section, but have not been able to
tell
which is the correct one... any suggestions would be greatly
appreciated...


Private Sub ReportFooter_Format(Cancel As Integer, FormatCount As
Integer)
varX = DLookup("[Flaged]", "tblProjectSchedule", "[Flaged] = vbTrue")
me.lblFlaged.visible = varX
End Sub


as always, thanks in advance,
mark
 

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