Report problem - what am I doing wrong?

Report problem - what am I doing wrong?

Post by rob » Wed, 08 Mar 2006 09:29:08


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
 
 
 

Report problem - what am I doing wrong?

Post by Allen Brow » Wed, 08 Mar 2006 09:40:04

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

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://www.yqcomputer.com/
Reply to group, rather than allenbrowne at mvps dot org.

 
 
 

Report problem - what am I doing wrong?

Post by rob » Wed, 08 Mar 2006 11:28:06

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