Access 2007 crashes when I use this macro to open/print reports

F

forest8

Hi there

One of my reports consists of two separate reports. This is my macro to
print the report out but as I mentioned in the subject, Access 2007 keeps
crashing.

How do I fix my error:

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


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.

Youth_ID
 
S

Steve Schapel

Forest,

First of all, this is not a macro. You are doing this in a VBA procedure,
which is a different kettle of fish.

What does "crashing" mean, in this context? Are you getting an error
message? If so, what does it say?

Is "R2-2a GPS_Youth" the correct name for the report? Is there a field in
the report named Youth_ID?

Where is the Print command button? Earler, you mentioned a subform. Is the
subform where the required Youth_ID reference field is? If so, is the
command button on the subform or the main form?
 
F

forest8

Hi


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.

Yes. R2-2a GPS_Youth" the correct name for the report. There is a field in
the report named Youth_ID. And yes, there is a field in the subform named
Youth_ID.

The print button is on the subform.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top