report of Filtered records (1 Viewer)

asad.saeed

Sharp Killer
Local time
Today, 19:27
Joined
Nov 28, 2008
Messages
30
I have an issue about report, I have a tabular form and i want to take report those records which is filtered in this form.

may be its simple but to much important for me..

Friends reply pls.....
 

vbaInet

AWF VIP
Local time
Today, 16:27
Joined
Jan 22, 2010
Messages
26,374
It depends on how it is filtered. Are you using the Filter button?

If that's the case then you can use Me.Filter in one of the arguments of DoCmd.OpenReport method:
Code:
DoCmd.OpenReport "ReportName", acViewPreview, , [COLOR=Red][B]Me.Filter[/B][/COLOR]

See this link for more information:

http://msdn.microsoft.com/en-us/library/bb243764(v=office.12).aspx
 

asad.saeed

Sharp Killer
Local time
Today, 19:27
Joined
Nov 28, 2008
Messages
30
thanks for your reply, but I have other problem.

I have to use Sort & Filter tab on the each column of record.

please reply how can I generate report of that records.
 

vbaInet

AWF VIP
Local time
Today, 16:27
Joined
Jan 22, 2010
Messages
26,374
Code:
DoCmd.OpenReport "ReportName", acViewPreview, , Me.Filter
Reports("ReportName").OrderBy = Me.OrderBy
Reports("ReportName").OrderByOn = True
 

asad.saeed

Sharp Killer
Local time
Today, 19:27
Joined
Nov 28, 2008
Messages
30
this code works on filter records but not not working in sorting!

why you add these two lines?
Reports("ReportName").OrderBy = Me.OrderBy
Reports("ReportName").OrderByOn = True
 

vbaInet

AWF VIP
Local time
Today, 16:27
Joined
Jan 22, 2010
Messages
26,374
Remove the sorting you set in the report's SORTING & GROUPING.

Those two lines are to apply the sort from the form to the report. Did you use them?
 

asad.saeed

Sharp Killer
Local time
Today, 19:27
Joined
Nov 28, 2008
Messages
30
I set sorting in Query, bot in report? do I've to remove from, there?
 

vbaInet

AWF VIP
Local time
Today, 16:27
Joined
Jan 22, 2010
Messages
26,374
Yes, remove the sorting in the query too. But I hope this query is not the query you are using for your form? If it is, just make a copy of it.
 

asad.saeed

Sharp Killer
Local time
Today, 19:27
Joined
Nov 28, 2008
Messages
30
same query is used in Form and Report.

Your code is working on filter but not in sort, when I sort data and take report the report, the report is not in Ascending order.

I don't know how to upload the file in this forum, otherwise I upload my file for you ease.

Please check where I'm going wrong, many thanks for your previous reply...may GOD bless you.
 

asad.saeed

Sharp Killer
Local time
Today, 19:27
Joined
Nov 28, 2008
Messages
30
Thanks a lot for lots of help!

Now I have attached file, please see where I'm going wrong.
 

Attachments

  • sort and filter.zip
    45.7 KB · Views: 92

vbaInet

AWF VIP
Local time
Today, 16:27
Joined
Jan 22, 2010
Messages
26,374
You attached your db with no data. Add some sample data of at least 5 records and re-attach the db.
 

asad.saeed

Sharp Killer
Local time
Today, 19:27
Joined
Nov 28, 2008
Messages
30
sorry I forget to put data
 

Attachments

  • sort and filter.zip
    48 KB · Views: 93

vbaInet

AWF VIP
Local time
Today, 16:27
Joined
Jan 22, 2010
Messages
26,374
Right click any part of the report (but not any control), click SORTING & GROUPING and it will appear at the bottom of the report. Click the X button on the right hand side of the field that you see in the window to delete it.
 

Users who are viewing this thread

Top Bottom