Report problem - what am I doing wrong?

R

rob

All,

Quick question....

I'm trying to filter out a report to just give me one record...

I'm testing my code using a command button. When I press the button, the
report still gives me every record. What am I doing wrong?

Private Sub Command0_Click()

Dim EPR
EPR = CStr(95) '95 is the PKID of the coversheets underlying
query/table

msgResponse = MsgBox("Print an EPR Coversheet?" & vbCrLf & vbCrLf & " ",
vbYesNo, "EPR Coversheet")

If msgResponse = 6 Then
Print_Cover_Sheet (EPR)
End If
End Sub


Function Print_Cover_Sheet(x As String)
On Error GoTo Err_Print_Cover_Sheet

Dim stDocName2 As String

stDocName2 = "rptCoverSheet2"

DoCmd.OpenReport stDocName2, acPreview, "tblEPR.PKID =" + x

Exit_Print_Cover_Sheet:
Exit Function

Err_Print_Cover_Sheet:
MsgBox Err.Description
Resume Exit_Print_Cover_Sheet

End Function
 
A

Allen Browne

You are missing a comma:
DoCmd.OpenReport stDocName2, acViewPreview,, "tblEPR.PKID =" & x
 
R

rob

UN - FREAKIN - BELIEVABLE!!!!

I spent half the day cussing out my computer because I could not get it to
work!

Maybe I'm losing my mind! Today it took me 25 minutes to boil water for my
daughters Mac and Cheese. After the first 20 minutes, I realized I turned
the heat on the wrong burner...

Anyway, thanks for the help!

Rob
 

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