Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Visible/Not Visible labels for ALL records 1

Status
Not open for further replies.

paulbradley

Programmer
Oct 9, 2002
158
GB
I have created an access report, which has a section where I want certain labels to be visible or not depending on other variables. This happens a number of times down the page for different records. I have used the following code:

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If [OriginalMark] = [ReMarkMark] Then
[Nochange].Visible = True
[ReMarkMark].Visible = False
[ReMarkGrade].Visible = False
End If
End Sub

OriginalMark, ReMarkMark, Nochange and RemarkGrade are all bound labels on the record.

However, it looks at the first record and depending on the result of the IF statement on that, does the same for every record on the page. How can I change it so it treats every record individually?

Many thanks in advance.
 
Have you tried using a group header and grouping on each value?
 
I'm afraid I am a complete novice - any chance of a layman's description?
 
On the View Menu, select Sorting & Grouping, then select a field to group on (your Record number, Doc number....)then in Group Properties, set it to Group On each value
 
Allready had one two of my records being sorted and set to group on each value - any other ideas?
 
If I'm reading this right, you have to set the alternate values when the controls are not equal. Something like this:

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If [OriginalMark] = [ReMarkMark] Then
[Nochange].Visible = True
[ReMarkMark].Visible = False
[ReMarkGrade].Visible = False
Else
[Nochange].Visible = False
[ReMarkMark].Visible = True
[ReMarkGrade].Visible = True

End If
End Sub


 
Sorry, I've already tried that - what I'm trying to say is that the IF statement reads in values from the 1st record listed on the report - then either makes the labels visible or not next to that record on the report. However, it then does the same for every other record rather than reading in information from them and altering the visible/not visible accordingly.

Hope this makes sence.
 
SORRY!!!!!! Cosomokramer - that DOES work! I've been very thick - i'm sure I tried something like that earlier.

Thanks for all your help!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top