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
|
|||
|
|||
Select Records to Print
I have created a form that allows me the ability to select what employees I
want to print a contract (report) for. It works great except for it always leaves the 1st person off. For example, if I put a check in the 3rd & 4th person's names on the form, only the 4th person's contract prints. If I put a check in the 1st, 2nd, 3rd, 4th, 5th, 6th person's name on the form, all print except for the 1st person. My code in the onclick event of the command button to print the report is: DoCmd.OpenReport stDocName, acPreview, , "[Print] = -1" where [Print] is the name of the checkbox Thanks for your help! |
#2
|
|||
|
|||
Select Records to Print
Since we do not see the entire code, do you have as the first line
Me.Refresh You can always base your report off a query which has the criteria of True for your check box. Either way, you should have Me.Refresh first or you lose the last field change. "Donna" wrote: I have created a form that allows me the ability to select what employees I want to print a contract (report) for. It works great except for it always leaves the 1st person off. For example, if I put a check in the 3rd & 4th person's names on the form, only the 4th person's contract prints. If I put a check in the 1st, 2nd, 3rd, 4th, 5th, 6th person's name on the form, all print except for the 1st person. My code in the onclick event of the command button to print the report is: DoCmd.OpenReport stDocName, acPreview, , "[Print] = -1" where [Print] is the name of the checkbox Thanks for your help! |
#3
|
|||
|
|||
Select Records to Print
Hi Donna,
do not use PRINT as a fieldname or controlname (etc), it is a reserved word Problem names and reserved words in Access, by Allen Browne http://www.allenbrowne.com/Ap****ueBadWord.html ~~~ my guess is that whatever record you are on is not being saved before the report is rendered. In the code behind your form, do this: if me.dirty then me.dirty = false if.me dirty -- returns TRUE if the record needs to be saved me.dirty = false -- saves the record .... then issue the command to do the report smile ~~~ whatever criteria you use must be fields ON the report in a control -- the Visible property can be no Warm Regards, Crystal * (: have an awesome day * Donna wrote: I have created a form that allows me the ability to select what employees I want to print a contract (report) for. It works great except for it always leaves the 1st person off. For example, if I put a check in the 3rd & 4th person's names on the form, only the 4th person's contract prints. If I put a check in the 1st, 2nd, 3rd, 4th, 5th, 6th person's name on the form, all print except for the 1st person. My code in the onclick event of the command button to print the report is: DoCmd.OpenReport stDocName, acPreview, , "[Print] = -1" where [Print] is the name of the checkbox Thanks for your help! |
#4
|
|||
|
|||
Select Records to Print
I changed the field name from Print to PrintRpt. Then I figured out that it
wasn't printing whatever the last record was that I was selecting on the form. So as long as I click anywhere on the form after I've made my last selection, all records checked get printed. I'm sure it's not supposed to work that way, but it does solve the problem for now. "Donna" wrote: I have created a form that allows me the ability to select what employees I want to print a contract (report) for. It works great except for it always leaves the 1st person off. For example, if I put a check in the 3rd & 4th person's names on the form, only the 4th person's contract prints. If I put a check in the 1st, 2nd, 3rd, 4th, 5th, 6th person's name on the form, all print except for the 1st person. My code in the onclick event of the command button to print the report is: DoCmd.OpenReport stDocName, acPreview, , "[Print] = -1" where [Print] is the name of the checkbox Thanks for your help! |
#5
|
|||
|
|||
Select Records to Print
Hi Donna,
"I changed the field name from Print to PrintRpt." good! "So as long as I click anywhere on the form after I've made my last selection, all records checked get printed. " that is not necessary if you include this code: if me.dirty then me.dirty = false 'me' refers to the form you are behind 'dirty' is the property that indicates True or False if unsaved changes have been made to a record this statement will save the record you have just modified -- and do nothing if no changes have been made Warm Regards, Crystal * (: have an awesome day * Donna wrote: I changed the field name from Print to PrintRpt. Then I figured out that it wasn't printing whatever the last record was that I was selecting on the form. So as long as I click anywhere on the form after I've made my last selection, all records checked get printed. I'm sure it's not supposed to work that way, but it does solve the problem for now. "Donna" wrote: I have created a form that allows me the ability to select what employees I want to print a contract (report) for. It works great except for it always leaves the 1st person off. For example, if I put a check in the 3rd & 4th person's names on the form, only the 4th person's contract prints. If I put a check in the 1st, 2nd, 3rd, 4th, 5th, 6th person's name on the form, all print except for the 1st person. My code in the onclick event of the command button to print the report is: DoCmd.OpenReport stDocName, acPreview, , "[Print] = -1" where [Print] is the name of the checkbox Thanks for your help! |
Thread Tools | |
Display Modes | |
|
|