I have a form (frm_DocsList) with a list box (lstQueries) which uses some SQL to pull in a list of some of my reports (the record source is set to SELECT MsysObjects.Name, Mid([Name],5) AS QueryName, Left([Name],4) AS Expr1 FROM MsysObjects WHERE (((Left([Name],4))="Rpts")) ORDER BY MsysObjects.Name Also in this form are the clientID, ClientName fields. The idea is that I can choose any one of these reports and open it for the specific client who is shown. But the code I have behind my button does not work. It doesnt seem to like me using criteria with this method. If I take away my strcriteria all the different reports open up beautifully - but not for that specific client. Any help appreciated.
Private Sub cmdPreview_Click()
' opens the report in preview
Dim strCriteria As String
strCriteria = "[ClientID] = & Forms![Frm_docsList]![clientid]"
DoCmd.OpenReport Me.lstQueries, acViewPreview, , strCriteria
End Sub
Private Sub cmdPreview_Click()
' opens the report in preview
Dim strCriteria As String
strCriteria = "[ClientID] = & Forms![Frm_docsList]![clientid]"
DoCmd.OpenReport Me.lstQueries, acViewPreview, , strCriteria
End Sub