Hide Line on Repeating Values

D

dsc2bjn

I have a report which have set several values to "Hide Duplicates".

I have line under each row of data. I wish to hide the line if the value in
the previous record is repeated.

I plan on using the "On Format" for the report section to control when the
line is displayed using "Visible".

I have very limited experience with VB. How do I write in code the command
that says, "If [Tracking Number] is equal to previous [Tracking Number] then
Line60.Visible=False
Else
Line60.Visible=True
 
B

bcap

Something like this I think:

Option Compare Database
Option Explicit

Dim mstrPrevTrackNumber As String

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)

Line60.Visible = ([Tracking Number] <> mstrPrevTrackNumber)

End Sub

Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)

mstrPrevTrackNumber = [Tracking Number]

End Sub

Please note, I have assumed that [Tracking Number] is a string. You will
need to change the code slightly if it's numeric.
 
D

dsc2bjn

Thanks!!!

That works exactly how I stated it.

I may have to re-think the logic behind this.

What I really need is a way to only draw the line when the Tracking Number
value changes or said differently...only when it is the last record for the
same Tracking Number.



bcap said:
Something like this I think:

Option Compare Database
Option Explicit

Dim mstrPrevTrackNumber As String

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)

Line60.Visible = ([Tracking Number] <> mstrPrevTrackNumber)

End Sub

Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)

mstrPrevTrackNumber = [Tracking Number]

End Sub

Please note, I have assumed that [Tracking Number] is a string. You will
need to change the code slightly if it's numeric.

dsc2bjn said:
I have a report which have set several values to "Hide Duplicates".

I have line under each row of data. I wish to hide the line if the value
in
the previous record is repeated.

I plan on using the "On Format" for the report section to control when the
line is displayed using "Visible".

I have very limited experience with VB. How do I write in code the
command
that says, "If [Tracking Number] is equal to previous [Tracking Number]
then
Line60.Visible=False
Else
Line60.Visible=True
 
B

bcap

Why don't you just group the report on Tracking Number, and have the line
(and only the line) in the group header (or the footer, if that works better
for you)? Much easier than faffing around with code.

dsc2bjn said:
Thanks!!!

That works exactly how I stated it.

I may have to re-think the logic behind this.

What I really need is a way to only draw the line when the Tracking
Number
value changes or said differently...only when it is the last record for
the
same Tracking Number.



bcap said:
Something like this I think:

Option Compare Database
Option Explicit

Dim mstrPrevTrackNumber As String

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)

Line60.Visible = ([Tracking Number] <> mstrPrevTrackNumber)

End Sub

Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)

mstrPrevTrackNumber = [Tracking Number]

End Sub

Please note, I have assumed that [Tracking Number] is a string. You will
need to change the code slightly if it's numeric.

dsc2bjn said:
I have a report which have set several values to "Hide Duplicates".

I have line under each row of data. I wish to hide the line if the
value
in
the previous record is repeated.

I plan on using the "On Format" for the report section to control when
the
line is displayed using "Visible".

I have very limited experience with VB. How do I write in code the
command
that says, "If [Tracking Number] is equal to previous [Tracking Number]
then
Line60.Visible=False
Else
Line60.Visible=True
 
D

dsc2bjn

Yea...I did that.

The client I work for is a little ....(you fill in the blank).

They want the report to look basically like a spreadsheet, but they only
want the Level 1 information to be displayed once on the report.

Example:

Tracking # | Description | Status | Corrective Action
_______________________________________________
|1 | Test1 | In Progress | Fix window |
| | | | Wash Car |

| | | | Wash Dog |
|______________________________________________|
|2 | Test2 | Completed | Paint Kitchen |
| | | | Dry Clothes |

|__________|__________|____________|___________ |

I drew a line under each corrective action in the detail section and placed
the other portion of the line in the Tracking number header. Since the two
lines aren't actually occuping the same space, the lines don't line up.

I thought by hiding the line periodically, I could accomplish what they want.



bcap said:
Why don't you just group the report on Tracking Number, and have the line
(and only the line) in the group header (or the footer, if that works better
for you)? Much easier than faffing around with code.

dsc2bjn said:
Thanks!!!

That works exactly how I stated it.

I may have to re-think the logic behind this.

What I really need is a way to only draw the line when the Tracking
Number
value changes or said differently...only when it is the last record for
the
same Tracking Number.



bcap said:
Something like this I think:

Option Compare Database
Option Explicit

Dim mstrPrevTrackNumber As String

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)

Line60.Visible = ([Tracking Number] <> mstrPrevTrackNumber)

End Sub

Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)

mstrPrevTrackNumber = [Tracking Number]

End Sub

Please note, I have assumed that [Tracking Number] is a string. You will
need to change the code slightly if it's numeric.

I have a report which have set several values to "Hide Duplicates".

I have line under each row of data. I wish to hide the line if the
value
in
the previous record is repeated.

I plan on using the "On Format" for the report section to control when
the
line is displayed using "Visible".

I have very limited experience with VB. How do I write in code the
command
that says, "If [Tracking Number] is equal to previous [Tracking Number]
then
Line60.Visible=False
Else
Line60.Visible=True
 
B

bcap

OK, if I understand you correctly, the code I gave you before will do the
job, you just need to put the line at the *top* of the detail section, not
the bottom.

dsc2bjn said:
Yea...I did that.

The client I work for is a little ....(you fill in the blank).

They want the report to look basically like a spreadsheet, but they only
want the Level 1 information to be displayed once on the report.

Example:

Tracking # | Description | Status | Corrective Action
_______________________________________________
|1 | Test1 | In Progress | Fix window |
| | | | Wash Car
|

| | | | Wash Dog
|
|______________________________________________|
|2 | Test2 | Completed | Paint Kitchen |
| | | | Dry Clothes
|

|__________|__________|____________|___________ |

I drew a line under each corrective action in the detail section and
placed
the other portion of the line in the Tracking number header. Since the two
lines aren't actually occuping the same space, the lines don't line up.

I thought by hiding the line periodically, I could accomplish what they
want.



bcap said:
Why don't you just group the report on Tracking Number, and have the line
(and only the line) in the group header (or the footer, if that works
better
for you)? Much easier than faffing around with code.

dsc2bjn said:
Thanks!!!

That works exactly how I stated it.

I may have to re-think the logic behind this.

What I really need is a way to only draw the line when the Tracking
Number
value changes or said differently...only when it is the last record for
the
same Tracking Number.



:

Something like this I think:

Option Compare Database
Option Explicit

Dim mstrPrevTrackNumber As String

Private Sub Detail_Format(Cancel As Integer, FormatCount As
Integer)

Line60.Visible = ([Tracking Number] <> mstrPrevTrackNumber)

End Sub

Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)

mstrPrevTrackNumber = [Tracking Number]

End Sub

Please note, I have assumed that [Tracking Number] is a string. You
will
need to change the code slightly if it's numeric.

I have a report which have set several values to "Hide Duplicates".

I have line under each row of data. I wish to hide the line if the
value
in
the previous record is repeated.

I plan on using the "On Format" for the report section to control
when
the
line is displayed using "Visible".

I have very limited experience with VB. How do I write in code the
command
that says, "If [Tracking Number] is equal to previous [Tracking
Number]
then
Line60.Visible=False
Else
Line60.Visible=True
 
D

dsc2bjn

Thanks!!!

I figured that out yesterday and discovered by doing so it leaves a open
ended row at the end of the section.

I added a footer for the section and placed a line across it to ensure once
a section was completed a line was drawn so it wouldn't look like:

____________________________________________________
| Data | Data |Data | Data
|


bcap said:
OK, if I understand you correctly, the code I gave you before will do the
job, you just need to put the line at the *top* of the detail section, not
the bottom.

dsc2bjn said:
Yea...I did that.

The client I work for is a little ....(you fill in the blank).

They want the report to look basically like a spreadsheet, but they only
want the Level 1 information to be displayed once on the report.

Example:

Tracking # | Description | Status | Corrective Action
_______________________________________________
|1 | Test1 | In Progress | Fix window |
| | | | Wash Car
|

| | | | Wash Dog
|
|______________________________________________|
|2 | Test2 | Completed | Paint Kitchen |
| | | | Dry Clothes
|

|__________|__________|____________|___________ |

I drew a line under each corrective action in the detail section and
placed
the other portion of the line in the Tracking number header. Since the two
lines aren't actually occuping the same space, the lines don't line up.

I thought by hiding the line periodically, I could accomplish what they
want.



bcap said:
Why don't you just group the report on Tracking Number, and have the line
(and only the line) in the group header (or the footer, if that works
better
for you)? Much easier than faffing around with code.

Thanks!!!

That works exactly how I stated it.

I may have to re-think the logic behind this.

What I really need is a way to only draw the line when the Tracking
Number
value changes or said differently...only when it is the last record for
the
same Tracking Number.



:

Something like this I think:

Option Compare Database
Option Explicit

Dim mstrPrevTrackNumber As String

Private Sub Detail_Format(Cancel As Integer, FormatCount As
Integer)

Line60.Visible = ([Tracking Number] <> mstrPrevTrackNumber)

End Sub

Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)

mstrPrevTrackNumber = [Tracking Number]

End Sub

Please note, I have assumed that [Tracking Number] is a string. You
will
need to change the code slightly if it's numeric.

I have a report which have set several values to "Hide Duplicates".

I have line under each row of data. I wish to hide the line if the
value
in
the previous record is repeated.

I plan on using the "On Format" for the report section to control
when
the
line is displayed using "Visible".

I have very limited experience with VB. How do I write in code the
command
that says, "If [Tracking Number] is equal to previous [Tracking
Number]
then
Line60.Visible=False
Else
Line60.Visible=True
 
M

Marshall Barton

Saving a value from one record to calculate/compare to a
value in another record is not a reliable approach to any
problem. Report sections can be processed in any order
(think about retreats caused by various KeepTogether
settings, preview navigation, use of Pages, etc) so you
never know which record the saved value came from.

The HideDuplicates property has a related property,
IsVisible, that can be used to do this kind of thing.

Line60.Visible = Me.[Tracking Number].IsVisible
--
Marsh
MVP [MS Access]

Something like this I think:

Option Compare Database
Option Explicit

Dim mstrPrevTrackNumber As String

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)

Line60.Visible = ([Tracking Number] <> mstrPrevTrackNumber)

End Sub

Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)

mstrPrevTrackNumber = [Tracking Number]

End Sub


dsc2bjn said:
I have a report which have set several values to "Hide Duplicates".

I have line under each row of data. I wish to hide the line if the value
in
the previous record is repeated.

I plan on using the "On Format" for the report section to control when the
line is displayed using "Visible".

I have very limited experience with VB. How do I write in code the
command
that says, "If [Tracking Number] is equal to previous [Tracking Number]
then
Line60.Visible=False
Else
Line60.Visible=True
 

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