INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

report of only labels - not running Detail onFormat event

report of only labels - not running Detail onFormat event

(OP)
I created a map of a casino floor - in a form using only labels. (The form works great)

Reason: the data displayed in the label doesn't change, the label shows the unique location designation of the machine (ex. AA0101) in the exact position it is located on the casino floor. The values of the recordset are displayed based on the label name by using the label backcolor - so each machine shows up as red or yellow, or green, for example, indicating if the value is a lot (hot/red) or little (cold/green), etc.

All works great.

But I'd like to get this in a report so a user can just print it. (currently i screen print the form)
As it took a long time to create all the labels for all the machines showing the floor configuration, I simply copied and pasted them into a report in the detail section.
I declared my db and recordset variables in the header of the module.
Then set them in OpenReport event
Then put my label coloring code in the Detail OnFormat event - with breakpoints

And when i run the report - it never even processes the Detail OnFormat event - doesn't break at any of the breakpoints.
I added a debug.print and nothing.
Why wouldn't it even go there? is it because i am using only labels?
So it isn't coloring my labels in the report.
Any suggestions on how to fix or make this in a different way?
Thank you for your help.
Option Compare Database
Public DB As DAO.Database
Public rs As DAO.Recordset

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

Dim intAvg As Integer
Dim lngRed As Long
Dim lngOrange As Long
Dim lngYellow As Long
Dim lngGreen As Long
Dim lngBlue As Long
Dim lngGrey As Long
Dim strFrm As String

Debug.Print

If rs.RecordCount > 0 Then

strFrm = "RptAvg"

lngRed = RGB(255, 0, 0) '(237, 28, 36)
lngOrange = RGB(255, 194, 14)
lngYellow = RGB(255, 242, 0)
lngGreen = RGB(167, 218, 78)
lngBlue = RGB(119, 192, 212)
lngGrey = RGB(165, 165, 165)

With rs
.MoveFirst
Do Until rs.EOF
strID = rs!location
intAvg = rs!AvgPDay

strName = "lbl" & strID

If fIsRptCtl(strFrm, strName) = False Then

GoTo MoveOn
End If


Select Case intAvg
Case -100000 To -1
Me(strName).BackColor = lngGrey
Case 0 To 50
Me(strName).BackColor = lngBlue
Case 51 To 100
Me(strName).BackColor = lngGreen
Case 101 To 150
Me(strName).BackColor = lngYellow
Case 151 To 200
Me(strName).BackColor = lngOrange
Case Is > 201
Me(strName).BackColor = lngRed

End Select

MoveOn:
varBookmark = .Bookmark
rs.MoveNext

Loop
End With
End If


End Sub

Private Sub Report_Close()
If IsObject(rs) Then rs.Close
If IsObject(DB) Then DB.Close
Set rs = Nothing
Set DB = Nothing
End Sub

Private Sub Report_Open(Cancel As Integer)
Dim qdf As QueryDef
Set DB = CurrentDb()
Set qdf = DB.QueryDefs("qryRptMapB")
Set rs = qdf.OpenRecordset()

End Sub

RE: report of only labels - not running Detail onFormat event

Need to open in Print Preview view.

RE: report of only labels - not running Detail onFormat event

I would probably place all the machines in a table with the coordinates and size. Then use code in the On Format event of the detail section to position and size a single text box. You can find some similar code in the Calendar Reports.

Duane
Hook'D on Access
MS Access MVP

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close