Connecting Tech Pros Worldwide Forums | Help | Site Map

Printing Problem

Member
 
Join Date: Mar 2008
Location: Falkirk
Posts: 62
#1: Mar 14 '08
Can anyone help me? I have put this bit of code into my database and i can see the results on screen but when i go to print the report it is linked to it doesn't print the information but it prints the rest of the report fine.
Expand|Select|Wrap|Line Numbers
  1. Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
  2.  
  3. If (Me.[Paid] = False) Then
  4.     Me.labelPaid.Visible = False
  5.     Me.PaidDate.Visible = False
  6.     Me.PaymentMethod.Visible = False
  7.     Me.PaymentNumber.Visible = False
  8. Else
  9.     Me.labelPaid.Visible = True
  10.     Me.PaidDate.Visible = True
  11.     Me.PaymentMethod.Visible = True
  12.     Me.PaymentNumber.Visible = True
  13. End If
  14.  
  15. End Sub

Moderator
 
Join Date: Feb 2008
Location: Beauly, near Inverness, Scotland
Posts: 1,576
#2: Mar 14 '08

re: Printing Problem


Hi. Your code is ok, as long as the control called Paid on your report is indeed a boolean (true/false) value, and when it runs it should hide or show the controls in the detail section of your report accordingly. When you say that the report does not print the information, can you advise whether or not the controls concerned are always being shown, always being hidden, or what?

-Stewart
Member
 
Join Date: Mar 2008
Location: Falkirk
Posts: 62
#3: Mar 14 '08

re: Printing Problem


Quote:

Originally Posted by Stewart Ross Inverness

Hi. Your code is ok, as long as the control called Paid on your report is indeed a boolean (true/false) value, and when it runs it should hide or show the controls in the detail section of your report accordingly. When you say that the report does not print the information, can you advise whether or not the controls concerned are always being shown, always being hidden, or what?

-Stewart

The checkbox called Paid is a (true/false) value. If it is checked on the Form PaymentConfirmation then it shows the information on the report. This works fine as i can see it on the screen until i want to print the report off. All the information on the report prints fine apart from the information from the code below which doesn't come out on the print out. the information is being pulled from a query. Do i have to put this code into the query or the form before it reaches the report for it to work?


Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If (Me.[Paid] = True) Then
Me.labelPaid.Visible = True
Me.PaidDate.Visible = True
Me.PaymentMethod.Visible = True
Me.PaymentNumber.Visible = True
Else
Me.labelPaid.Visible = False
Me.PaidDate.Visible = False
Me.PaymentMethod.Visible = False
Me.PaymentNumber.Visible = False
End If
End Sub
Moderator
 
Join Date: Feb 2008
Location: Beauly, near Inverness, Scotland
Posts: 1,576
#4: Mar 14 '08

re: Printing Problem


Quote:

Originally Posted by Wayneyh

The checkbox called Paid is a (true/false) value. If it is checked on the Form PaymentConfirmation then it shows the information on the report. This works fine as i can see it on the screen until i want to print the report off. All the information on the report prints fine apart from the information from the code below which doesn't come out on the print out. the information is being pulled from a query. Do i have to put this code into the query or the form before it reaches the report for it to work?

Hi. The code is fine - you don't have to place this anywhere other than where it is for it to do its job. However, you say in your reply that Paid is on your form. It is not the form which matters - the field Paid must be included in the query on which your report is based, and it must also be included as a control in the detail section of your report. You can set the properties for the control to Visible=No to hide it if you wish not to see it, but it must be present on your report. If it is not there the DetailFormat code will not be able to refer to it and test its value.

I am wondering if you are actually referring to two different things here - I would guess the use of a single check box on the form which is to be ticked to show all values paid and unticked to show all values not paid, with the need to show or hide particular controls on your report. If, as I suspect, this is the case there are other ways to do it. Please let me know in your next response.

-Stewart
Member
 
Join Date: Mar 2008
Location: Falkirk
Posts: 62
#5: Mar 14 '08

re: Printing Problem


Quote:

Originally Posted by Stewart Ross Inverness

Hi. The code is fine - you don't have to place this anywhere other than where it is for it to do its job. However, you say in your reply that Paid is on your form. It is not the form which matters - the field Paid must be included in the query on which your report is based, and it must also be included as a control in the detail section of your report. You can set the properties for the control to Visible=No to hide it if you wish not to see it, but it must be present on your report. If it is not there the DetailFormat code will not be able to refer to it and test its value.

I am wondering if you are actually referring to two different things here - I would guess the use of a single check box on the form which is to be ticked to show all values paid and unticked to show all values not paid, with the need to show or hide particular controls on your report. If, as I suspect, this is the case there are other ways to do it. Please let me know in your next response.

-Stewart

Yes that is correct. Please advise
Moderator
 
Join Date: Feb 2008
Location: Beauly, near Inverness, Scotland
Posts: 1,576
#6: Mar 14 '08

re: Printing Problem


Quote:

Originally Posted by Wayneyh

Yes that is correct. Please advise

OK. I am taking it that you are confirming that there is a single check box on your form which filters the form to show paid or unpaid records, and you want to implement this for your report.

You need to provide more information about what is in the query on which your report is based. In particular, I need to know the names of the main fields of this query which are of interest in showing and hiding payment details. I would also appreciate a copy of the After Update code for the checkbox in your form, as this will tell me how the form is being filtered to show only the paid or unpaid records.

-Stewart
Member
 
Join Date: Mar 2008
Location: Falkirk
Posts: 62
#7: Mar 14 '08

re: Printing Problem


Quote:

Originally Posted by Stewart Ross Inverness

OK. I am taking it that you are confirming that there is a single check box on your form which filters the form to show paid or unpaid records, and you want to implement this for your report.

You need to provide more information about what is in the query on which your report is based. In particular, I need to know the names of the main fields of this query which are of interest in showing and hiding payment details. I would also appreciate a copy of the After Update code for the checkbox in your form, as this will tell me how the form is being filtered to show only the paid or unpaid records.

-Stewart

I have managed to fix the problem. Thanks for your help anyway.
Moderator
 
Join Date: Feb 2008
Location: Beauly, near Inverness, Scotland
Posts: 1,576
#8: Mar 14 '08

re: Printing Problem


Quote:

Originally Posted by Wayneyh

I have managed to fix the problem. Thanks for your help anyway.

I am very glad you were able to fix this; would you mind telling us what you did to resolve your problem? It may help others who read the forum too.

Thanks

-Stewart
Reply