PC Review


Reply
Thread Tools Rate Thread

Can't get this code to work properly to print

 
 
forest8
Guest
Posts: n/a
 
      16th Apr 2010
Hi there

One of my reports consists of two separate reports. This is my VBA Cidse to
print the report out but as I mentioned in the subject, Access 2007 keeps
crashing. That is, when I try to print this report, Access 2007 closes and I
get an error message to send the issue to Microsoft. It reopens the database
and creates a backup.

How do I fix my issue? Here is the code:

Private Sub Print_Click()

Dim strDocName As String
Dim strWhere As String
strDocName = "R2-2a GPS_Youth"
strWhere = "Youth_ID=" & Me.Youth_ID
DoCmd.OpenReport "R2-2a GPS_Youth", acPrint, , strWhere
strDocName = "R2-2b GPS_Youth"

End Sub


R2-2a GPS_Youth" the correct name for the first report. There is a field in
the report named Youth_ID. There is a also a field in the subform named
Youth_ID.

The print button is on the subform.

I can't even print out the first part of my report yet alone both parts.

The two parts of my report is one single table with over 50 variables. I
know I should have normalized my table but to do that as this junction would
take more time than I can afford.

Please any advice is greatly appreciated.

PS. I earlier posted this question in the wrong section.
 
Reply With Quote
 
 
 
 
Tom van Stiphout
Guest
Posts: n/a
 
      16th Apr 2010
On Thu, 15 Apr 2010 20:15:01 -0700, forest8
<(E-Mail Removed)> wrote:

You may have some form of corruption. This code looks good.
Make a safety copy of your db. Then compact it.
Here is an article about recovering from corruption:
http://allenbrowne.com/ser-47.html

-Tom.
Microsoft Access MVP


>Hi there
>
>One of my reports consists of two separate reports. This is my VBA Cidse to
>print the report out but as I mentioned in the subject, Access 2007 keeps
>crashing. That is, when I try to print this report, Access 2007 closes and I
>get an error message to send the issue to Microsoft. It reopens the database
>and creates a backup.
>
>How do I fix my issue? Here is the code:
>
>Private Sub Print_Click()
>
>Dim strDocName As String
>Dim strWhere As String
>strDocName = "R2-2a GPS_Youth"
>strWhere = "Youth_ID=" & Me.Youth_ID
>DoCmd.OpenReport "R2-2a GPS_Youth", acPrint, , strWhere
>strDocName = "R2-2b GPS_Youth"
>
>End Sub
>
>
> R2-2a GPS_Youth" the correct name for the first report. There is a field in
>the report named Youth_ID. There is a also a field in the subform named
>Youth_ID.
>
>The print button is on the subform.
>
>I can't even print out the first part of my report yet alone both parts.
>
>The two parts of my report is one single table with over 50 variables. I
>know I should have normalized my table but to do that as this junction would
>take more time than I can afford.
>
>Please any advice is greatly appreciated.
>
>PS. I earlier posted this question in the wrong section.

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Code to save Word-document do not work properly jkrons Microsoft Excel Programming 3 6th May 2010 08:44 PM
Print Button Does Not Work Properly =?Utf-8?B?VHkgQXJjaGVy?= Microsoft Access Reports 2 24th Sep 2007 09:16 PM
My Code doesn't work properly cho Microsoft Access VBA Modules 2 28th Feb 2007 01:59 PM
Re: Why doesn't page.isvalid work properly with this code? John Saunders Microsoft ASP .NET 2 4th Jun 2004 10:10 PM
Can't get code to work properly. Please Help! sparky3883 Microsoft Excel Programming 2 15th Apr 2004 01:55 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:57 PM.