Values in Text Boxes disappear

kompkar

New member
Local time
Today, 02:04
Joined
May 2, 2008
Messages
7
I created a form which loads values into a report.

When the report opens in 'Report' mode - acViewReport - I can see the values I set for the text boxes in the report.

However when I press 'Print Preview', the values in the report disappear and all I can see are the 'label text' for the text boxes I setup in the Report

-
The code in the form that activate the report is
Code:
Private Sub Command0_Click()
Dim reportname As New Report

DoCmd.OpenReport "dfsdf", acViewReport, , , acWindowNormal
Set reportname = Reports![dfsdf]
reportname!Text0.SetFocus
reportname!Text0.Text = "sdfsd"
 
End Sub

For this example, the only control on the report is a single text box called "Text0". and the only control on the form is a command button called "Command0"

Please could somebody help, as I've built up two large reports using loads of text boxes, it all works fine, but I need to be able to print, and when using print preview all the values disapper - I tried just clicking print too, but that too doesn't work - the values are not getting printed.
 
What is the source for the report? what version of MS Office are you using?
 
I'm using MS Access 2007 - MS Office 2007.

The report is not linked to any tables or queries - I've code in the form which access the tables, does the calculations, and loads the final values into various text boxes which I've setup in the report. All works fine - the calculated values get displayed in the various text boxes in the report - but when I click Print Preview, the values disappear and only the labels stay on !
 
I checked out that link in the above post - but I couldn't figure it out, really sorry but I'm just starting out with Access.
Could you possibly break it down for me - what is the "IIf" statement in the code in the link above.

I changed my code to the following, but the report is showing an error in the text field - "#Name?"
(Code)
reportname!Text0.controlsource = "sdfsd"
(code/)
 
How about uploading a sample of your database just showing the table, query (if created), form which has the data, and the report.

You can place in some dummy data, then it will be easier to look at and explain and give you a working sample.
 
Hi - I've attached a sample DB with this post - just one button in a form, and one text box (Name) in the report. As you can see, when I press the buttton, the name is set as "David" - but when I "Print Preview", the value disappears
 

Attachments

Ok this might be what your after, but I have created a txtbox on the form and given it the name txtName and placed in a value ="David" (as per your sample).

Then on the report placed the control source to link to the txtbox on the form, so as David is the text value it then shows this in the report in Print Preview. Please see sample returned.
 

Attachments

Users who are viewing this thread

Back
Top Bottom