About Report filtering!

S

Sam Hung

Hi,

The previous question I posted here a week ago was solved.
This time I encountered another trouble on report
filtering. Bascially, the filtering function is included
in forms (tabular form) and reports. As my records in
forms are like:
fld1 fld2 fld3
Name1 20 30
Name4 f1 f1
Name3 50 40
Name4 f9 f9
Name4 f5 f5

An additional text field (text1) in forms for user to type
in and filter the records. As I type "Mame4" in text1,
only 3 records are selected.
fld1 fld2 fld3
Name4 f1 f1
Name4 f9 f9
Name4 f5 f5

Different results in reports as it shouldn't be:
fld1 fld2 fld3
Name4 f5 f5
Name4 f1 f1
Name4 f9 f9

I think I didn't do any sorting in forms and reports.
Source Code:
Properties "On Key Down":
Private Sub mat_prod_code_KeyDown(KeyCode As Integer,
Shift As Integer)
If KeyCode = 13 Then
Me.Filter = "table1.text1='" & Trim
(mat_prod_code.Text) & "'"
If Forms!form1![text1] <> "" Then
Me.FilterOn = True
Else
Me.FilterOn = False
End If
End If
End Sub

Preview Button - Properties "On Click"
Private Sub Command103_Click()
Dim strWhere As String
If Me.Dirty Then
Me.Dirty = False
End If
If Me.FilterOn Then
strWhere = Me.Filter
DoCmd.OpenReport "report1", acViewPreview, , strWhere
DoCmd.Maximize
Else
DoCmd.OpenReport "report1", acViewPreview
DoCmd.Maximize
End If
End Sub

Please help,
Thanks,
Sam.
 
J

Jeff Boyce

Sam

Reports have their own sorting/grouping. Use the Toolbar button in design
mode for Reports. Also check Sorting and Grouping in Access HELP.

Good luck

Jeff Boyce
<Access MVP>
 

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

Similar Threads


Top