Report_Load event and acViewNormal

Birdman895

Registered User.
Local time
Today, 12:35
Joined
Apr 19, 2012
Messages
62
I have a report that runs code in Report_load, and based on the value of a field it sets some objects Visible=False and others Visible=True etc.. Now I'm trying to move away from acViewPreview and print direct to the printer with acViewNormal but the Report_Load event doesn't run. Is there a different way to run that code when printing directly?
 
I have a report that runs code in Report_load, and based on the value of a field it sets some objects Visible=False and others Visible=True etc..
Perhaps you could explain this part and we might find an alternative.
 
Here is the code below. This report is configured a number of different ways depending on values in a table field, and responses from the user right before printing. It also is a rarely used report.
It works fine as-is as long as it's opened in Preview and I'm thinking of just leaving it that way.
Alan

Private Sub Report_Load()
If ReportID = 0 Then
If Me.Interstate.Value = "Yes" Then
Me.chkInterstateYes.Visible = True
Me.chkInterstateNo.Visible = False
Me.ClientName.Visible = True
Me.Text53.Visible = True
Me.Date.Visible = True
If Me.CurrentProbation.Value = "Yes" Or Me.CurrentParole.Value = "Yes" Then
Me.chkLocalNo.Visible = False
Me.chkLocalYes.Visible = True
Else
Me.chkLocalNo.Visible = True
Me.chkLocalYes.Visible = False
End If
Me.Check20.Visible = True
Me.Check21.Visible = True
Me.ClientName2.Visible = True
Me.DOB.Visible = True
Me.SSN.Visible = True
Me.PlaceBirth.Visible = True
Me.Date2.Visible = True
Me.OutOfState.Visible = True
Me.Probation.Visible = True
Me.Parole.Visible = True
Else
Me.chkInterstateYes.Visible = False
Me.chkInterstateNo.Visible = True
Me.ClientName.Visible = False
Me.Text53.Visible = False
Me.Date.Visible = False
Me.chkLocalYes.Visible = False
Me.chkLocalNo.Visible = False
Me.Check20.Visible = False
Me.Check21.Visible = False
Me.ClientName2.Visible = False
Me.DOB.Visible = False
Me.SSN.Visible = False
Me.PlaceBirth.Visible = False
Me.Date2.Visible = False
Me.OutOfState.Visible = False
Me.Probation.Visible = False
Me.Parole.Visible = False
End If
Exit Sub
Else
Me.chkInterstateYes.Visible = False
Me.chkInterstateNo.Visible = False
Me.ClientName.Visible = False
Me.Text53.Visible = False
Me.Date.Visible = False
Me.chkLocalYes.Visible = False
Me.chkLocalNo.Visible = False
Me.Check20.Visible = False
Me.Check21.Visible = False
Me.ClientName2.Visible = False
Me.DOB.Visible = False
Me.SSN.Visible = False
Me.PlaceBirth.Visible = False
Me.Date2.Visible = False
Me.OutOfState.Visible = False
Me.Probation.Visible = False
Me.Parole.Visible = False
Me.Text7.Visible = False
Me.DateofBirth.Visible = False
End If

End Sub
 
Hi,
1st, I followed your link to a Bob Larson post and I do not find anything. There's no text, no link to anything explaining the code tags.
The post is marked as Closed.

2nd, there is another sub that opens the report with;

Docmd.OpenReport MyReportName, acViewPreview, , "[fk_ClientID]=" & Me.ClientID.Value, acDialog

This works fine. But when I change the acViewPreview to acViewNormal to send it directly to the printer, then it does not run the Report_Load event code and the report is not correct.
If I put the code in Current would that run it properly?
 
It's a Closed thread meaning members can't post to it, but that's weird that you can't see anything. I think the website is having problems rendering the image that was attached to it. I'll get one of the Mods to rectify.

Leave it as acViewPreview or acViewReport and it will run fine.
 
Code tags simply means putting code in this format:

[c o d e]
If ReportID = Then

End If
[/ c o d e]
Without the spaces. That helps to preserve the formatting and thus making code easier to read.
 
I noticed that after I hit Submit.
When I pasted the code into this editor it was properly indented and spaced.

As far as the report goes I think leaving it in acViewPreview will work just fine.
Thanks for your help
 
Yes, it will look good after pasting but once you hit submit all the formatting gets stripped away. With the code tag it stays in place.

Good. You're welcome!
 
Also,
I went back to your link for the Bob Larson code tag post and if I had scrolled down a little bit, Uncle Gizmo had posted a good link for it.
I see how to use them
Alan
 
Yes, I made Uncle G aware (as promised) and he's put a temporary fix at the moment.
 

Users who are viewing this thread

Back
Top Bottom