compile error

K

kev.thorpe

Hi,

I am trying to filter a report using a form's filter, following
instructions I found on the internet. I am however running into
compile error: end if without block if.


The code as it appears in my database is:


Private Sub cmdOpenReport_Click()
If Me.Filter = "" Then
MsgBox "Apply a filter to the form first."
Else
DoCmd.OpenReport "rptCustomers", acViewPreview, , Me.Filter
End If
End Sub


and here is the code from the internet

Private Sub cmdOpenReport_Click()
If Me.Filter = "" Then
MsgBox "Apply a filter to the form first."
Else
DoCmd.OpenReport "rptCustomers", acViewPreview, , Me.Filter
End If
End Sub

What am I missing???
 
N

n00b

I ran the code and it compiles just fine and runs just fine. Do you
get the compile error just when you click or are you compiling the
entire database when you get the error? The error has to be somewhere
else.
 

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