A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Setting Up & Running Reports
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Printing only filtered data in a form



 
 
Thread Tools Display Modes
  #1  
Old November 30th, 2007, 05:26 PM posted to microsoft.public.access.reports
Printing only filtered data in a form
external usenet poster
 
Posts: 1
Default Printing only filtered data in a form

Hi all-

I'm of new to Access 2007. I have created a form and a report. Is it
possible to have the user use the built in filter Access provides and click
the report button and print only that data. Each time I open the form
different data will need to be selected by the user.
  #2  
Old December 1st, 2007, 03:41 AM posted to microsoft.public.access.reports
Allen Browne
external usenet poster
 
Posts: 11,706
Default Printing only filtered data in a form

For a simple filter, you can just use the form's Filter string as the
WhereCondition for OpenReport.

This example assumes a command button named cmdPreview, that is to open
Report1 filtered the same way as the form:

Private Sub cmdPreview_Click()
Dim strWhere As String
If Me.Dirty Then Me.Dirty = False
If Me.FilterOn Then strWhere = Me.Filter
DoCmd.OpenReport "report1", acViewPreview, , strWhere
End Sub

It can get more complex where combos are involved. Post back if you have
difficulties.

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Printing only filtered data in a form" Printing only filtered data in a
wrote in message
...
Hi all-

I'm of new to Access 2007. I have created a form and a report. Is it
possible to have the user use the built in filter Access provides and
click
the report button and print only that data. Each time I open the form
different data will need to be selected by the user.


  #3  
Old December 2nd, 2007, 08:58 AM posted to microsoft.public.access.reports
Bernie
external usenet poster
 
Posts: 125
Default Printing only filtered data in a form



"Allen Browne" wrote:

For a simple filter, you can just use the form's Filter string as the
WhereCondition for OpenReport.

This example assumes a command button named cmdPreview, that is to open
Report1 filtered the same way as the form:

Private Sub cmdPreview_Click()
Dim strWhere As String
If Me.Dirty Then Me.Dirty = False
If Me.FilterOn Then strWhere = Me.Filter
DoCmd.OpenReport "report1", acViewPreview, , strWhere
End Sub

It can get more complex where combos are involved. Post back if you have
difficulties.

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Printing only filtered data in a form" Printing only filtered data in a
wrote in message
...
Hi all-

I'm of new to Access 2007. I have created a form and a report. Is it
possible to have the user use the built in filter Access provides and
click
the report button and print only that data. Each time I open the form
different data will need to be selected by the user.




Try this one, I know it is a bit complicated but you can use any queries or
sql statements to filter report data.

Private Sub Trip_Sheet_Click()

If Forms!frmTripheader!tabTripHeaderID "" Then
Call Fuel_Click
rep = "Trip Sheet"
repname = "repTripSheet"
repquery = strSQL
reptitle = "Trip Sheet"
Call OpenReport(rep, repquery, reptitle, repname)
Else
MsgBox ("Please chose trip"), vbInformation, "Trip Sheet"

End If

End Sub


repquery = "select * from tabtripheader where tabtripheaderid = " & Forms
  #4  
Old December 3rd, 2007, 04:55 PM posted to microsoft.public.access.reports
Printing only filtered data in a form[_2_]
external usenet poster
 
Posts: 5
Default Printing only filtered data in a form

I tried the example code but there's no action when I click on the
(cmdPreview button.) I replaced "report1" with my report's name.

"Allen Browne" wrote:

For a simple filter, you can just use the form's Filter string as the
WhereCondition for OpenReport.

This example assumes a command button named cmdPreview, that is to open
Report1 filtered the same way as the form:

Private Sub cmdPreview_Click()
Dim strWhere As String
If Me.Dirty Then Me.Dirty = False
If Me.FilterOn Then strWhere = Me.Filter
DoCmd.OpenReport "report1", acViewPreview, , strWhere
End Sub

It can get more complex where combos are involved. Post back if you have
difficulties.

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Printing only filtered data in a form" Printing only filtered data in a
wrote in message
...
Hi all-

I'm of new to Access 2007. I have created a form and a report. Is it
possible to have the user use the built in filter Access provides and
click
the report button and print only that data. Each time I open the form
different data will need to be selected by the user.



  #5  
Old December 4th, 2007, 12:11 PM posted to microsoft.public.access.reports
Allen Browne
external usenet poster
 
Posts: 11,706
Default Printing only filtered data in a form

Is the code running at all?
To find out, you could add this line to the top of the procedu
MsgBox "cmdPreview_Click is doing something."

If it is not working at all, you may need to add your database's folder to
the trusted locations under:
Office Button | Access Options | Trust Center | Trust Center Settings

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Printing only filtered data in a form"
soft.com wrote in message
...
I tried the example code but there's no action when I click on the
(cmdPreview button.) I replaced "report1" with my report's name.

"Allen Browne" wrote:

For a simple filter, you can just use the form's Filter string as the
WhereCondition for OpenReport.

This example assumes a command button named cmdPreview, that is to open
Report1 filtered the same way as the form:

Private Sub cmdPreview_Click()
Dim strWhere As String
If Me.Dirty Then Me.Dirty = False
If Me.FilterOn Then strWhere = Me.Filter
DoCmd.OpenReport "report1", acViewPreview, , strWhere
End Sub

It can get more complex where combos are involved. Post back if you have
difficulties.

"Printing only filtered data in a form" Printing only filtered data in a
wrote in message
...
Hi all-

I'm of new to Access 2007. I have created a form and a report. Is it
possible to have the user use the built in filter Access provides and
click
the report button and print only that data. Each time I open the form
different data will need to be selected by the user.


  #6  
Old December 4th, 2007, 03:36 PM posted to microsoft.public.access.reports
Printing only filtered data in a form[_2_]
external usenet poster
 
Posts: 5
Default Printing only filtered data in a form

When I click the button - even with ( MsgBox "cmdPreview_Click is doing
something.") the filter and paste buttons located at the top tool bar grays
out.

"Allen Browne" wrote:

Is the code running at all?
To find out, you could add this line to the top of the procedu
MsgBox "cmdPreview_Click is doing something."

If it is not working at all, you may need to add your database's folder to
the trusted locations under:
Office Button | Access Options | Trust Center | Trust Center Settings

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Printing only filtered data in a form"
soft.com wrote in message
...
I tried the example code but there's no action when I click on the
(cmdPreview button.) I replaced "report1" with my report's name.

"Allen Browne" wrote:

For a simple filter, you can just use the form's Filter string as the
WhereCondition for OpenReport.

This example assumes a command button named cmdPreview, that is to open
Report1 filtered the same way as the form:

Private Sub cmdPreview_Click()
Dim strWhere As String
If Me.Dirty Then Me.Dirty = False
If Me.FilterOn Then strWhere = Me.Filter
DoCmd.OpenReport "report1", acViewPreview, , strWhere
End Sub

It can get more complex where combos are involved. Post back if you have
difficulties.

"Printing only filtered data in a form" Printing only filtered data in a
wrote in message
...
Hi all-

I'm of new to Access 2007. I have created a form and a report. Is it
possible to have the user use the built in filter Access provides and
click
the report button and print only that data. Each time I open the form
different data will need to be selected by the user.



  #7  
Old December 5th, 2007, 01:46 PM posted to microsoft.public.access.reports
Allen Browne
external usenet poster
 
Posts: 11,706
Default Printing only filtered data in a form

Does the MsgBox() pop up?

- No: set the trust centre options.

- Yes: Enter Stop on the next line. When it stops, press F8 to trace what's
going on.

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Printing only filtered data in a form"
soft.com wrote in message
...
When I click the button - even with ( MsgBox "cmdPreview_Click is doing
something.") the filter and paste buttons located at the top tool bar
grays
out.

"Allen Browne" wrote:

Is the code running at all?
To find out, you could add this line to the top of the procedu
MsgBox "cmdPreview_Click is doing something."

If it is not working at all, you may need to add your database's folder
to
the trusted locations under:
Office Button | Access Options | Trust Center | Trust Center Settings

"Printing only filtered data in a form"
soft.com wrote in
message
...
I tried the example code but there's no action when I click on the
(cmdPreview button.) I replaced "report1" with my report's name.

"Allen Browne" wrote:

For a simple filter, you can just use the form's Filter string as the
WhereCondition for OpenReport.

This example assumes a command button named cmdPreview, that is to
open
Report1 filtered the same way as the form:

Private Sub cmdPreview_Click()
Dim strWhere As String
If Me.Dirty Then Me.Dirty = False
If Me.FilterOn Then strWhere = Me.Filter
DoCmd.OpenReport "report1", acViewPreview, , strWhere
End Sub

It can get more complex where combos are involved. Post back if you
have
difficulties.

"Printing only filtered data in a form" Printing only filtered data
in a
wrote in message
...
Hi all-

I'm of new to Access 2007. I have created a form and a report. Is it
possible to have the user use the built in filter Access provides
and
click
the report button and print only that data. Each time I open the
form
different data will need to be selected by the user.


  #8  
Old December 5th, 2007, 04:45 PM posted to microsoft.public.access.reports
Printing only filtered data in a form[_2_]
external usenet poster
 
Posts: 5
Default Printing only filtered data in a form

Hey Allen Browne-

Thank You!!!! It works now!! You have been very helpful!

"Allen Browne" wrote:

Does the MsgBox() pop up?

- No: set the trust centre options.

- Yes: Enter Stop on the next line. When it stops, press F8 to trace what's
going on.

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Printing only filtered data in a form"
soft.com wrote in message
...
When I click the button - even with ( MsgBox "cmdPreview_Click is doing
something.") the filter and paste buttons located at the top tool bar
grays
out.

"Allen Browne" wrote:

Is the code running at all?
To find out, you could add this line to the top of the procedu
MsgBox "cmdPreview_Click is doing something."

If it is not working at all, you may need to add your database's folder
to
the trusted locations under:
Office Button | Access Options | Trust Center | Trust Center Settings

"Printing only filtered data in a form"
soft.com wrote in
message
...
I tried the example code but there's no action when I click on the
(cmdPreview button.) I replaced "report1" with my report's name.

"Allen Browne" wrote:

For a simple filter, you can just use the form's Filter string as the
WhereCondition for OpenReport.

This example assumes a command button named cmdPreview, that is to
open
Report1 filtered the same way as the form:

Private Sub cmdPreview_Click()
Dim strWhere As String
If Me.Dirty Then Me.Dirty = False
If Me.FilterOn Then strWhere = Me.Filter
DoCmd.OpenReport "report1", acViewPreview, , strWhere
End Sub

It can get more complex where combos are involved. Post back if you
have
difficulties.

"Printing only filtered data in a form" Printing only filtered data
in a
wrote in message
...
Hi all-

I'm of new to Access 2007. I have created a form and a report. Is it
possible to have the user use the built in filter Access provides
and
click
the report button and print only that data. Each time I open the
form
different data will need to be selected by the user.



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 07:18 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.