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 » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Select Records to Print



 
 
Thread Tools Display Modes
  #1  
Old April 9th, 2008, 04:40 PM posted to microsoft.public.access.forms
Donna
external usenet poster
 
Posts: 565
Default 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  
Old April 9th, 2008, 08:58 PM posted to microsoft.public.access.forms
Jackie L
external usenet poster
 
Posts: 148
Default 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  
Old April 9th, 2008, 09:10 PM posted to microsoft.public.access.forms
strive4peace
external usenet poster
 
Posts: 1,670
Default 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  
Old April 10th, 2008, 06:36 PM posted to microsoft.public.access.forms
Donna
external usenet poster
 
Posts: 565
Default 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  
Old April 10th, 2008, 07:49 PM posted to microsoft.public.access.forms
strive4peace
external usenet poster
 
Posts: 1,670
Default 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

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 12:07 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.