code for continuos report problem

G

Guest

I have created a continous report, (which is part of a parent report)
In the table that populates it there are 2 yes no fields called "OK" and "NA".
If "NA" is set to true I would like a label to become visible (Which says
N/A!) and the check to become not visible. I entered this code in the detail
section of the report:

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If Me.NA = True Then
Me.NAlabel.Visible = True
Me.OK.Visible = False
End If
End Sub

But when any NA is set to true it changes every line in the continuos
report, rather than just the line relative to the User entry
What am I doing wrong?
Thanks
 
F

fredg

I have created a continous report, (which is part of a parent report)
In the table that populates it there are 2 yes no fields called "OK" and "NA".
If "NA" is set to true I would like a label to become visible (Which says
N/A!) and the check to become not visible. I entered this code in the detail
section of the report:

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If Me.NA = True Then
Me.NAlabel.Visible = True
Me.OK.Visible = False
End If
End Sub

But when any NA is set to true it changes every line in the continuos
report, rather than just the line relative to the User entry
What am I doing wrong?
Thanks

Any time you use code to toggle visibility on, you must also use code
to toggle it off.

Using your code, you could have used:

If Me![NA] = True Then
Me![NAlabel].Visible = True
Me![OK].Visible = False
Else
Me![NAlabel].Visible = False
Me![OK].Visible = True
End If

An easier way would be:

Me![NALabel].Visible = Me![NA]
Me![OK].Visible = Not Me![NA]
 

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