Preview report based on filter query (1 Viewer)

azhar2006

Registered User.
Local time
Today, 01:33
Joined
Feb 8, 2012
Messages
202
Hello all
I have a report based on a query, and in this query, I make a filter for the information included in it through a form. I have put a print button on the form that previews the report based on the filtering process through a text box. But when the report appears, all the data, not the filtered data, appears on the form.
thanks for the help
 

Ranman256

Well-known member
Local time
Today, 04:33
Joined
Apr 9, 2015
Messages
4,337
are you using someithing like:

sFlt = "[ClientID]=" & me.cboClient
docmd.OpenReport "rptName",acViewPreview ,sFlt

better is:
docmd.OpenReport "rptName",acViewPreview , , sFlt
 

azhar2006

Registered User.
Local time
Today, 01:33
Joined
Feb 8, 2012
Messages
202
are you using someithing like:

sFlt = "[ClientID]=" & me.cboClient
docmd.OpenReport "rptName",acViewPreview ,sFlt

better is:
docmd.OpenReport "rptName",acViewPreview , , sFlt
Thank you dear Ranman256
did not work for me.
Just to inform you something that I use in the textbox filter based on this code.
Code:
Private Sub TypeDown(strSearch As String)
On Error Resume Next
    
    Dim StrSQL As String
        
    If strSearch = "" Then
        StrSQL = "QurMastr"
    Else
        StrSQL = "SELECT * FROM QurMastr " & _
                 " WHERE FullName Like '" & strSearch & "*' " & " OR bookNumber Like '" & strSearch & "*' " _
                 & " OR Result Like '" & strSearch & "*' "
    End If
    Me.sfrmForm.Form.RecordSource = StrSQL
    Me.sfrmForm.Form.Requery
    Me.txtSearch.SetFocus
    
End Sub
 

Users who are viewing this thread

Top Bottom