Text box shows text in print preview within sub reports but when I save the report as a PDF the textbox is clear (1 Viewer)

stee_97

New member
Local time
Today, 07:14
Joined
Aug 24, 2021
Messages
7
Hello, I am pretty new to using Microsoft Access and VBA in general and within my final year project at University I am required to use Microsoft Access. The issue I am having is that I want to save my master report (With 4 sub reports) as a PDF. When I press a button for my report to be filled out, the text goes into the text boxes into the sub report, however, when I save them - the text is no longer there, and only my main report still has text. This is shown in the attatched images (no text in the yellow box which is the PDF - which I have also attatched), does anyone know what the issue could be? The text boxes are all visible.

Any help would be appreciated!
 

Attachments

  • PDF no text.jpg
    PDF no text.jpg
    31.8 KB · Views: 132
  • VBA print preview.jpg
    VBA print preview.jpg
    25.6 KB · Views: 126
  • Feedback for group1.pdf
    66.5 KB · Views: 130

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 23:14
Joined
Oct 29, 2018
Messages
17,177
Hi. Welcome to AWF!

Just curious, is this project for school work?
 

stee_97

New member
Local time
Today, 07:14
Joined
Aug 24, 2021
Messages
7
Hi. Welcome to AWF!

Just curious, is this project for school work?
Hello,

This project is actually part of my final report for my Masters Degree!
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 02:14
Joined
May 21, 2018
Messages
5,690
Anything happen if you change the color scheme on the textbox background and the font color?
Are those boxes unbound? Not sure if that makes any difference, I would have to test.
Can you post a demo?
 

stee_97

New member
Local time
Today, 07:14
Joined
Aug 24, 2021
Messages
7
Anything happen if you change the color scheme on the textbox background and the font color?
Are those boxes unbound? Not sure if that makes any difference, I would have to test.
Can you post a demo?
Thank you for replying!

Nothing happens when I change the colour scheme etc, and all the boxes are unbound. In my code I tell the boxes to have text in them depending on if conditions.

A snippet of my code can be seen below:

If (rs70.Fields(3).Value = rs74.Fields(0) Or rs70.Fields(3).Value = rs74.Fields(1) Or rs70.Fields(3).Value = rs74.Fields(2) Or rs70.Fields(3).Value = rs74.Fields(3) Or rs70.Fields(3).Value = rs74.Fields(4) Or rs70.Fields(3).Value = rs74.Fields(5)) And (rs69.Fields(2) = "Submitted evidence") Then
good5 = good5 & rs82.Fields(2) + vbCrLf
g43 = rs84.Fields(2)
Else
weak5 = weak5 & rs83.Fields(2) + vbCrLf
End If
Reports!Feedbacksheet_Q20!SR_Feedbacksheet_Q8![Q5_task1good] = good5
Reports!Feedbacksheet_Q20!SR_Feedbacksheet_Q8![Q5_task1weak] = weak5

With the text box being called Q5_task1good and Q5_task1weak - in the picture Q5_task1good was equal to "" therefore it was empty.

I don't think I would be able to post a demo as it takes it requires me to import various custom excel files however, the action is that I press a button once the database is filled with the excel files, and the textboxs which are in the subreport (SR_Feedbacksheet_Q8 should be displayed in the main report (Feedbacksheet_Q20).

The code starts with

DoCmd.OpenReport "Feedbacksheet_Q20", acViewPreview, "", "", , acHidden

Which displays the report in print preview and print preview shows that the text boxes in the subreport are populated, however, when I save them as a PDF or print them, only the textboxes in the main report are populated and the textbox in the subreport is left blank.

I could send my code if that would help?
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 01:14
Joined
Feb 28, 2001
Messages
21,208
The issue is PROBABLY that you are doing something in the report's OnPrint routine but for some reason, the "Convert To PDF" operation doesn't count that as a print action, it counts it as a display action. Look in your OnPrint routine for the section that contains the miscreant controls to see what you are doing. Do that in the OnFormat routine instead.
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 02:14
Joined
May 21, 2018
Messages
5,690
I could send my code if that would help?
I doubt it because it sounds like your code is populating fine, it is just not printing out. Can you create a new database and import just that form and the tables that feed that form. They only need a few records not everything.
 

stee_97

New member
Local time
Today, 07:14
Joined
Aug 24, 2021
Messages
7
The issue is PROBABLY that you are doing something in the report's OnPrint routine but for some reason, the "Convert To PDF" operation doesn't count that as a print action, it counts it as a display action. Look in your OnPrint routine for the section that contains the miscreant controls to see what you are doing. Do that in the OnFormat routine instead.
Thank you for the reply @The_Doc_Man

Sorry if this is a simple stupid question, I am really new to VBA and MS Access and struggle quite abit with it. Could you please tell me how to do that or what you mean with the OnPrint routine.


DoCmd.SetWarnings False
DoCmd.OutputTo objecttype:=acOutputReport, objectName:="Feedbacksheet_Q20", outputformat:=acFormatPDF, outputFile:=exportpath & "Feedback for group" & Groupnumber & ".pdf"
DoCmd.SetWarnings True

That is how I "print out" - (Make PDFs) the forms using VBA as they are in a loop, I save multiple files in my directory.

Sorry if anything I asked or said was simple
 
Last edited:

stee_97

New member
Local time
Today, 07:14
Joined
Aug 24, 2021
Messages
7
I doubt it because it sounds like your code is populating fine, it is just not printing out. Can you create a new database and import just that form and the tables that feed that form. They only need a few records not everything.
I tried using a new database and I still get the same results :/.


DoCmd.SetWarnings False
DoCmd.OutputTo objecttype:=acOutputReport, objectName:="Feedbacksheet_Q20", outputformat:=acFormatPDF, outputFile:=exportpath & "Feedback for group" & Groupnumber & ".pdf"
DoCmd.SetWarnings True

That is the code I use to get my PDFs if that helps? It's weird because I can see its all correct on print preview, however, all the sub reports are empty? Could this be a software issue? Or would it be due to my database?
 
Last edited:

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 15:14
Joined
May 7, 2009
Messages
14,648
maybe you can share your db by uploading here?
 

stee_97

New member
Local time
Today, 07:14
Joined
Aug 24, 2021
Messages
7
maybe you can share your db by uploading here?
Thanks for the reply @arnelgp

I have attatched a zip file of my db


The code is found under “Question 20” in the navigation bar under the form “generate 20 questions”. There is a button called generate feedback - the build event has the code for the report and subreport.

The report is called Feedbacksheet_20Q

the subreport is called SR_Feedbacksheet_8Q

the other sub reports are pretty much identical, just different text boxes however I haven’t included the code for those text boxes but it’s pretty much the same
 

Attachments

  • Automated System V6 - Copy.zip
    757.9 KB · Views: 131
Last edited:

MajP

You've got your good things, and you've got mine.
Local time
Today, 02:14
Joined
May 21, 2018
Messages
5,690
Can you create a new database and import just that form and the tables that feed that form. They only need a few records not everything.
Sorry my post was incomplete. I meant to say do that and post us the stripped down DB. Before posting anything make sure to compact and repair. This is under File, Info. Then zip it up. It should go.
 

stee_97

New member
Local time
Today, 07:14
Joined
Aug 24, 2021
Messages
7
Sorry my post was incomplete. I meant to say do that and post us the stripped down DB. Before posting anything make sure to compact and repair. This is under File, Info. Then zip it up. It should go.
Thats fine!


I have managed to attach it here! Thank you for telling me how to upload on here

The code is found under “Question 20” in the navigation bar under the form “generate 20 questions”. There is a button called generate feedback - the build event has the code for the report and subreport.

The report is called Feedbacksheet_20Q

the subreport is called SR_Feedbacksheet_8Q

the other sub reports are pretty much identical, just different text boxes however I haven’t included the code for those text boxes but it’s pretty much the same
 

Attachments

  • Automated System V6 - Copy.zip
    757.9 KB · Views: 132
Last edited:

MajP

You've got your good things, and you've got mine.
Local time
Today, 02:14
Joined
May 21, 2018
Messages
5,690
I do not want to hurt your feelings, but you really should have come here a long time ago. It looks like you have over a hundred tables, forms, and reports. I am pretty sure I could have built this with less than 10 total objects. For sure less than 15.
Are you to far along to fix this? It is so unwieldy that any suggestion is just a band aid. This violates almost every rule of database design. If you have the time to fix this now, the outcome would make this so, so, so much easier to work with, design, and maintain. In my opinion and I am sure others on this forum will agree, this is unusable in this state.
The good news if you are willing, we will help you fix this. The experts here can do this relatively quick. Then everything will be so much easier to do. For example you only need 2 reports to maintain and not 18. That means you make a change in only 2 not 18. The amount of tables is extreme. At most this can be done in 5 tables.
It is up to you on where you want to go. The problem is when things are this broke, people are reluctant to come up with a quick fix band aid, because it is peeling an onion. One band aid, requires two more, etc. So I doubt you will get much help if you do not decide to fix this. You can read my threads, I spend hours helping people and provide extensive help. I would help you rebuild this and so would others, but I would not waste my time looking at the current issue and trying to give you a band aid.
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 02:14
Joined
May 21, 2018
Messages
5,690
One more thing. This is speaking from someone who specializes in data analysis. If your Masters thesis requires you to then analyze this data ( I have to assume this is the purpose), there is no way this can be done unless this crazy design is fed into some other application.
This looks like an attempt at making a survey database, which I will argue is one of the hardest database to properly design. A properly designed (and highly flexible, and complex db) :
 
Last edited:

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 15:14
Joined
May 7, 2009
Messages
14,648
You need to save those textbox to a table.
 

Users who are viewing this thread

Top Bottom