I'm trying to open a report using the following code:
I get prompted for a parameter (the name of the city) even when info is entered on the form, if I re-enter the parameter it opens the report ignoring the strWhere, and if I don't re-enter the parameter it opens the report without records.
Any idea what's wrong?
Code:
Private Sub cmdPrintSample_Click()
Dim strWhere As String
strWhere = Nz([Forms]![frmReports]![cboCity], "'" & "*" & "'") & _
" AND " _
& Nz([Forms]![frmReports]![cboNeighborhood], "'" & "*" & "'") & _
" AND " _
& Nz([Forms]![frmReports]![cboRooms], "'" & "*" & "'")
DoCmd.OpenReport "rptSampler", acViewPreview, , strWhere
End Sub
Any idea what's wrong?
Comment