quirk or what?

  • Thread starter Thread starter Russ
  • Start date Start date
R

Russ

I've got a report that has the following code in the On No Data event:

Private Sub Report_NoData(Cancel As Integer)
Label7.Visible = No
Label9.Visible = Yes

End Sub


Label 9 will not become visible when I run the report but Label 7
becomes invisible. I've tried to set label 9 as visible and relocated
it to the visible/no page header section, then make the page header
section visible with this code, but still no dice. Both of the labels
are in the report header normally.

Is this odd or am I doing something wrong?

Russ
 
I've just tried this and it works fine. I made 1 label Invisible in
Properties and the other Visible in Properties and the code you wrote below
worked fine if I took data out of the table.

The only difference is I used


Private Sub Report_NoData(Cancel As Integer)
Me.Label7.Visible = False
Me.Label9.Visible = True
End Sub

No and Yes weren't recognised in my Access 97.

I assume you meant False and True though.

The NoData code won't work with subreports you know. For them there is a
handy code called HasData


Private Sub PageHeader_Format(Cancel As Integer, FormatCount As Integer)
Me.Label9.Visible = Me.RptGotNoDataSub.Report.HasData
If Me.RptGotNoDataSub.Report.HasData Then
Me.Label7.Visible = False
Else
Me.Label7.Visible=True
End If

End Sub

Evi
 
Showing my numbskull here looks like. I've not done alot of coding,
and I put the yes/no in there instead of the True/False. Duh.

Thanks for the extra info on HasData too.

Russ
 
The thing that stumped me was that it shouldn't have made anything appear/or
disappear with Yes/No. it should have just given you an error message.
Naughty, naughty Access!
Evi
 
Back
Top