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
|
|||
|
|||
Limiting Report to Current Record
I have a form based on a query for viewing customer
records (selected from a 3rd party database). The query can return from 1 to 1000 records depending on the criteria that you enter. This query works fine, the desired records match all of the criteria entered. This form works fine, it lists only those records returned by the query and its subforms likewise lists only the contacts directly related to each record in this query. I included a command button on the main form which will allow you to print from one to six reports based the records returned in this query. This also works fine, if the query returns 4 records then the print button prints each record as appropriate (i.e. if I choose to print all six reports for these 4 customers then I get 24 reports as expected). Now my form displays one record at a time, but when I hit the print button, I print all of the records from the query. What I want to do is print just the current record from my screen. EX: if my query returns 500 records and I am viewing record # 463, then I want to print record 463, not all 500 of them. I've done a bit of searching here and on other access sites and haven't been able to find anything helpful. The On Click event for my print button looks like this: Private Sub CmdCustomPrint_Click() Dim ArrReports(5, 1) As String Dim i As Integer 'put the actual report and checkbox names next ArrReports(0, 0) = "rptCustomData" ArrReports(1, 0) = "rptCustomDataAfterHoursContacts" ArrReports(2, 0) = "rptCustomDataComments" ArrReports(3, 0) = "rptCustomDataNotes" ArrReports(4, 0) = "rptCustomDataSchedules" ArrReports(5, 0) = "rptCustomDataZoneListings" ArrReports(0, 1) = "chkSiteInformation" ArrReports(1, 1) = "chkAfterHoursContacts" ArrReports(2, 1) = "chkComments" ArrReports(3, 1) = "chkNotes" ArrReports(4, 1) = "chkSchedules" ArrReports(5, 1) = "chkZoneListings" For i = 0 To 5 If Me.Controls(ArrReports(i, 1)) = True Then DoCmd.OpenReport ArrReports(i, 0), acViewNormal End If Next i End Sub Where the 'ArrReports(i, 1)' is a checkbox for whether you want to print that report or not. Clicking all reports in a large selection can add up to a lot of paper. What do I need to add to this to get just the current record? |
#2
|
|||
|
|||
Limiting Report to Current Record
On my website (see sig below) is a small sample database called
"PrintOneLabel.mdb" which illustrated 3 different ways to do this. Don't be put off by the "label" business though. A label report works just like any other report, it just has colums. The same methods will work for regular reports. -- --Roger Carlson www.rogersaccesslibrary.com Reply to: Roger dot Carlson at Spectrum-Health dot Org "Ernie" wrote in message ... I have a form based on a query for viewing customer records (selected from a 3rd party database). The query can return from 1 to 1000 records depending on the criteria that you enter. This query works fine, the desired records match all of the criteria entered. This form works fine, it lists only those records returned by the query and its subforms likewise lists only the contacts directly related to each record in this query. I included a command button on the main form which will allow you to print from one to six reports based the records returned in this query. This also works fine, if the query returns 4 records then the print button prints each record as appropriate (i.e. if I choose to print all six reports for these 4 customers then I get 24 reports as expected). Now my form displays one record at a time, but when I hit the print button, I print all of the records from the query. What I want to do is print just the current record from my screen. EX: if my query returns 500 records and I am viewing record # 463, then I want to print record 463, not all 500 of them. I've done a bit of searching here and on other access sites and haven't been able to find anything helpful. The On Click event for my print button looks like this: Private Sub CmdCustomPrint_Click() Dim ArrReports(5, 1) As String Dim i As Integer 'put the actual report and checkbox names next ArrReports(0, 0) = "rptCustomData" ArrReports(1, 0) = "rptCustomDataAfterHoursContacts" ArrReports(2, 0) = "rptCustomDataComments" ArrReports(3, 0) = "rptCustomDataNotes" ArrReports(4, 0) = "rptCustomDataSchedules" ArrReports(5, 0) = "rptCustomDataZoneListings" ArrReports(0, 1) = "chkSiteInformation" ArrReports(1, 1) = "chkAfterHoursContacts" ArrReports(2, 1) = "chkComments" ArrReports(3, 1) = "chkNotes" ArrReports(4, 1) = "chkSchedules" ArrReports(5, 1) = "chkZoneListings" For i = 0 To 5 If Me.Controls(ArrReports(i, 1)) = True Then DoCmd.OpenReport ArrReports(i, 0), acViewNormal End If Next i End Sub Where the 'ArrReports(i, 1)' is a checkbox for whether you want to print that report or not. Clicking all reports in a large selection can add up to a lot of paper. What do I need to add to this to get just the current record? |
#3
|
|||
|
|||
Limiting Report to Current Record
Thanks, I'll check into that.
By the way, your download, option "A third way to do it" prints '#error' three times instead of a label. -----Original Message----- On my website (see sig below) is a small sample database called "PrintOneLabel.mdb" which illustrated 3 different ways to do this. Don't be put off by the "label" business though. A label report works just like any other report, it just has colums. The same methods will work for regular reports. -- --Roger Carlson www.rogersaccesslibrary.com Reply to: Roger dot Carlson at Spectrum-Health dot Org "Ernie" wrote in message ... I have a form based on a query for viewing customer records (selected from a 3rd party database). The query can return from 1 to 1000 records depending on the criteria that you enter. This query works fine, the desired records match all of the criteria entered. This form works fine, it lists only those records returned by the query and its subforms likewise lists only the contacts directly related to each record in this query. I included a command button on the main form which will allow you to print from one to six reports based the records returned in this query. This also works fine, if the query returns 4 records then the print button prints each record as appropriate (i.e. if I choose to print all six reports for these 4 customers then I get 24 reports as expected). Now my form displays one record at a time, but when I hit the print button, I print all of the records from the query. What I want to do is print just the current record from my screen. EX: if my query returns 500 records and I am viewing record # 463, then I want to print record 463, not all 500 of them. I've done a bit of searching here and on other access sites and haven't been able to find anything helpful. The On Click event for my print button looks like this: Private Sub CmdCustomPrint_Click() Dim ArrReports(5, 1) As String Dim i As Integer 'put the actual report and checkbox names next ArrReports(0, 0) = "rptCustomData" ArrReports(1, 0) = "rptCustomDataAfterHoursContacts" ArrReports(2, 0) = "rptCustomDataComments" ArrReports(3, 0) = "rptCustomDataNotes" ArrReports(4, 0) = "rptCustomDataSchedules" ArrReports(5, 0) = "rptCustomDataZoneListings" ArrReports(0, 1) = "chkSiteInformation" ArrReports(1, 1) = "chkAfterHoursContacts" ArrReports(2, 1) = "chkComments" ArrReports(3, 1) = "chkNotes" ArrReports(4, 1) = "chkSchedules" ArrReports(5, 1) = "chkZoneListings" For i = 0 To 5 If Me.Controls(ArrReports(i, 1)) = True Then DoCmd.OpenReport ArrReports(i, 0), acViewNormal End If Next i End Sub Where the 'ArrReports(i, 1)' is a checkbox for whether you want to print that report or not. Clicking all reports in a large selection can add up to a lot of paper. What do I need to add to this to get just the current record? . |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Print Current Record Only | Melissa Lambino | New Users | 7 | July 27th, 2004 06:14 PM |
filter adp report where record source uses aggregate functions | eddiec | General Discussion | 6 | July 12th, 2004 07:48 AM |
Label | SRIT | General Discussion | 2 | June 22nd, 2004 09:42 PM |
trying to query current record on form in order to email that reco | JulieC | Running & Setting Up Queries | 0 | June 9th, 2004 05:38 PM |
Printing report for current record | Linda | Setting Up & Running Reports | 1 | May 26th, 2004 05:46 PM |