VB Procedure Onclick Button to open Report

  • Thread starter Thread starter dan.cawthorne
  • Start date Start date
D

dan.cawthorne

I've been trying to write a bit of code that will print a particular
report, if the form fiters are active, if not all records are
displayed and i cant get it to work I've tried the following

Private Sub CmdPrintList_Click()
If Me.FilterOn = True ( <------------------------------That line is
Giving me a GoTo Error)

DoCmd.OpenReport "View All Projects", acViewPreview, , Me.Filter

Else: Me.FilterOn = False

DoCmd.OpenReport "View All Projects", acViewPreview
End If

End Sub
 
Try this:

Private Sub CmdPrintList_Click()
If Me.FilterOn = True Then
DoCmd.OpenReport "View All Projects", acViewPreview, , Me.Filter
Else
DoCmd.OpenReport "View All Projects", acViewPreview
End If
End Sub

Steve
 
Try this:

Private Sub CmdPrintList_Click()
If Me.FilterOn = True Then
DoCmd.OpenReport "View All Projects", acViewPreview, , Me.Filter
Else
DoCmd.OpenReport "View All Projects", acViewPreview
End If
End Sub

Steve

Thanks Steve, So I See I Missed the "Then" Word Feel Like a Fool!
 
You'll not do it again will you! :)

Steve

It Was My First Attempt a making my own IF type Piece a Code, Its
quite logical really when you get your head round it.
 
Back
Top