PDA

View Full Version : Solved: AcPreview Vs Print



kvb
03-22-2007, 07:36 AM
Hi,
I am running a report/subreport with Access 2000, the subreport has some conditions regarding textbox visibility based on the value of another textbox on the same subreport. This code is placed in the format detail section of the subreport (see below). On the design of the report I have set the visibility to no for the labels and boxes concerned.

MY PROBLEM IS:

When this report previews on the screen, it appears correct. HOWEVER when I send it a printer, it seems to ignore the conditional formatting.

If I send this report direct to a printer, it will print correct.

I have observed the same behaviour in Access 2003.

Does anyone have idea what causes this.

Thanks in advance

Ken



Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Dim IN_IO As String
IN_IO = Report_rptInput.txtIO.Value
If IN_IO Like "A*" Then
Report_rptInput.txtCal.Visible = True
Report_rptInput.lblCal.Visible = True
Report_rptInput.txtEU.Visible = True
Report_rptInput.lblEU.Visible = True
End If
If IN_IO Like "FF" Then
Report_rptInput.txtCal.Visible = True
Report_rptInput.lblCal.Visible = True
Report_rptInput.txtEU.Visible = True
Report_rptInput.lblEU.Visible = True
End If
If IN_IO Like "D*" Then
Report_rptInput.txtCal.Visible = False
Report_rptInput.lblCal.Visible = False
Report_rptInput.txtEU.Visible = False
Report_rptInput.lblEU.Visible = False
End If
End Sub


Edited 28-Mar-07 by geekgirlau. Reason: insert vba tags

geekgirlau
03-28-2007, 01:19 AM
Hi Ken,

I took the liberty of inserting VBA tags in your post - if you are posting code, make sure you select it and click on the VBA button to make it easier to read.

Quick question: you refer to all of your controls as "Report_rptInput.[control]" - is "Report_rptInput" the name of your report? If so, have you tested this using "Me.[control]" instead?

kvb
03-29-2007, 04:57 AM
Hi Geekgirlau,

Thanks for helping me out. The change in the way I refer to my controls solved my problem.

Cheers

Ken

:friends:

geekgirlau
03-29-2007, 05:23 PM
My pleasure Ken - don't forget to mark the thread as solved, using the Thread Tools at the top of the screen.