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. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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 | |
|
|