Compile Error: End If without block If?

  • Thread starter Thread starter Jen
  • Start date Start date
J

Jen

Why do I keep getting this error End If without block If from the code
below?

Private Sub ReportFooter_Format(Cancel As Integer, FormatCount As Integer)
Me.NumCopiesPrinted = Me.NumCopiesPrinted + 1

If FormatCount = 1 Then
Select Case NumCopies
Case 1
Me.WhichCopy.Visible = False
Case 2
Me.WhichCopy.Caption = "Own Copy"
Me.WhichCopy.Visible = True
Case 3
Me.WhichCopy.Caption = "Accounting Copy"
Me.WhichCopy.Visible = True
Case 4
Me.WhichCopy.Caption = "Supervisor Copy"
Me.WhichCopy.Visible = True

End If
End Sub

Jen
 
As i see in the code you sent, i think that there is
an "end select" missing.
The correct syntax is:
if ..... then
...
...
select case ....
case ...
case ...
end select <---- MISSING !!!
end if
 
Got it. Thank you both.

I tried it myself, but thought it was wrong when it said "You can't assign a
value to this object" so I removed it.
Now it tells me the same again ("You can't assign a value to this object")
highlighting the
Me.NumCopiesPrinted = Me.NumCopiesPrinted + 1
section of the code. This code is btw in the onFormat event of the report.
Any ideas for this problem?

Jen.
 
Jen said:
Got it. Thank you both.

I tried it myself, but thought it was wrong when it said "You can't assign a
value to this object" so I removed it.
Now it tells me the same again ("You can't assign a value to this object")
highlighting the
Me.NumCopiesPrinted = Me.NumCopiesPrinted + 1
section of the code. This code is btw in the onFormat event of the report.
Any ideas for this problem?

During printing you can only assign values to controls that have no ControlSource.
Is the ControlSource for NumCopiesPrinted blank?
 
Back
Top