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 Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Event procedure on format error? 1

Status
Not open for further replies.

ffleitas

Technical User
Mar 15, 2001
85
US
Hello programmers,

When I request a report to print I get an error with this code. I have this activate in the detail section with the event procedure on format. I am sure this occurs because there is no data to be displayed. How can I stop this code from running if the data is null?

Sample of vb code that is activated:

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Const WHITE = 16777215
Const GRAY = 12632256

If (Me![LineNum] Mod 2) = 0 Then
Me![MemberID].BackColor = WHITE
Me![DateOfPlan].BackColor = WHITE
Me![Text74].BackColor = WHITE

Else
Me![MemberID].BackColor = GRAY
Me![DateOfPlan].BackColor = GRAY
Me![Text74].BackColor = GRAY


End If
End Sub

Sincerely,
Felix
 
The data won't be null since there are no records. You could try this:
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Const WHITE = 16777215
Const GRAY = 12632256
If Me.HasData = True
If (Me![LineNum] Mod 2) = 0 Then
Me![MemberID].BackColor = WHITE
Me![DateOfPlan].BackColor = WHITE
Me![Text74].BackColor = WHITE
Else
Me![MemberID].BackColor = GRAY
Me![DateOfPlan].BackColor = GRAY
Me![Text74].BackColor = GRAY
End If
End If
End Sub


Duane
MS Access MVP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top