Compile Error: End If without block If?

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
 
D

Dimitris

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
 
J

Jen

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.
 
R

Rick Brandt

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?
 

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