Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Values not appearing on printing of report

Status
Not open for further replies.

anasazii

Programmer
Jun 19, 2001
59
0
0
US
Hello

Just wondering if anyone has had this problem?

I have a report w/several subreports. In these subreports I have unbound text boxes that I have coded in the Report Activate event (of the main report) to show certain values based on other fields' values in the subreports(check boxes to be specific).

When I preview the report, everything appears fine but when I actually print the report, none of the unbound values appear. Is there a property somewhere that needs to be changed? Or maybe some more coding I need to do elsewhere?

Thanks, Janel
 
don't put it in the Activate Event put it in the open Event Hope this helps if not let me know

Jn88
Jn88@att.net
 
Hi Jn88!

I tried moving code to Open Event, and it gives me the following error:


Run-time error '2455':
You entered an expression that has an invalid reference to the property Form/Report.


Here's a bit of my code that is causing the error:

If (Reports![Doctor_Information]![medical_info subreport].Report.lic_susp = -1) Then
Reports![Doctor_Information]![medical_info subreport].Report.lic_sus.Visible = False
Reports![Doctor_Information]![medical_info subreport].Report.licsusYes = "Yes"
Reports![Doctor_Information]![medical_info subreport].Report.dateSuspDum.Visible = True
Else
Reports![Doctor_Information]![medical_info subreport].Report.lic_susp.Visible = False
Reports![Doctor_Information]![medical_info subreport].Report.licsusYes = "No"
Reports![Doctor_Information]![medical_info subreport].Report.lic_susp_when.Visible = False
Reports![Doctor_Information]![medical_info subreport].Report.dateSuspDum.Visible = True
Reports![Doctor_Information]![medical_info subreport].Report.dateSuspDum = "N/A"
End If


It's the same code that I had in Activate event. It's basically the same logic for every field listed in the report.

Let me know if you have any other ideas.
Janel


 
I think I managed to get it. I put the code in the ON Print event of the detail section, and so far it seems to be printing ok. There's still some little bugs to work out, but at least I got this one out of the way.

Thanks,
Janel
 
hi there Janel
I am also working on a report which requires that a label be displayed (or not displayed) depending on whether a check box is true or not. I was wondering if you might be able to forward a segment of code which would help me with this issue.
thanks a lot
roddy
 
Hi Roddy

I'll try to help you as best as I can. Most of my coding is pretty similar to what I've already posted. First, I check for the value, and then depending on that, I set the visible property on the textbox that I'm using, and then the value of what I want to appear in the textbox

If the checkbox is marked, its value is -1, otherwise 0.
In your situation, my first guess would be to check for the value and then set the visible property of the label:

If (Me.checkbox = -1) Then
Me.label.visible = true
End If

You can also set the caption property of the label to say other things:

Me.label.caption = "Hi"

I don't know how your report is set up, but when I tried to actually implement this code on the subreport that I was testing it on, the only time I could get it to work was in the On Print event. It seems like the on activate event should trigger it, but maybe that's something on my end since I'm working w/a subreport.

Hope this helps? If you need more code, let me know.

Janel
 
hi there Janel
now that i look at your code a little closer, i'm seeing how it works with the check boxes and such.
thankyou for the help. This should do the trick.
roddy
 
hi there again,
well i was able to make things appear and disappear depending on the value of a check box, thankyou for your help with that. Now, i'm trying to make things appear or disappear depending on whether or not there is a value in a text box on the form.
here is the segment of code i am using (i've tried it in both in the Detail - Format and Detail - Print sections).

Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
If (Forms![TAB DISPLAY FORM]![txtOther Option 1] = "") Then
Me.Other_Option_1___text.Visible = False
Me.lblOtherNull1.Visible = True
Else
Me.lblOtherNull1.Visible = False
End If
End Sub

thanks, roddy
 
Hi Roddy
So your trying to get items to appear/disappear on your report based on items on form? I'm assuming the item that you're trying to make disappear is still staying visible?

Going by what you've told me, there are two things that come to my mind.

First, I haven't ever done what you are trying to do, but when I test for textbox values on forms, I usually use the IsNull function also, such as the following code from one of my forms:

If IsNull(Me.dateLastContact.Value) Or (Me.dateLastContact = "") Then
response = MsgBox("Date of last Contact is required.", vbOKOnly, "Date Missing")
Me.dateLastContact.SetFocus
Exit Sub
End If


Secondly, the other thing that I can think of is when I have my report show something based on what is entered on the form, I do the checking in the Report_Activate Event, such as the following:

Private Sub Report_Activate()
DoCmd.Maximize
Dim x 'number representing a month
x = [Forms]![Search_Doctors_Birthdates]![searchmonth]
month.Caption = MonthName(x)
End Sub

I added in the following in my Sub and it did make my label disappear. I'm unable to check to see if it works w/a null value though.

If (x = 11) Then
Me.birthdate_Label.Visible = False
End If

Hope some of this helps?
Janel
 
nicely done Janel
The IsNull segment of code works very nicely. For some reason i guess it apparently tests something that = Null or =" " may not test.
thank you vm
roddy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top