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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Unable to Print DETAIL from form...

Status
Not open for further replies.

tEkHEd

IS-IT--Management
Jan 29, 2003
261
GB
Hi there, I hope that someone can help me out here.. (again!! :) )

basically I have a form that has a header and footer. The header contains a title, and the footer contains my "print" button.

The detail section of the form, contains a listbox, a combo box and some txt boxes to display results.

When I click my print button, all that gets actually printed is my header and my footer.. :¬/

I want to be able to print the detail of the form (or even just the content of the listbox and other controls) but don't seem able to do this... I have checked the properties of the detail section and have made sure that the detail section has the 'Display When' control set to always.

When I open the form in Print Preview mode, I am also unable to see the detail section.

Is this because the print button is on the footer? I am sure that this is a simple thing that I am just missing...

Many thanks for any help..
 
What does your code look like in the OnClick event of the print button?

Take a look at this thread thread702-522676 for another idea of printing forms.
 
mm the code behind my button is simply:

DoCmd.PrintOut

If I move the button to the detail section, it works fine..

a nice function that I would like to include, would be to resize the listbox so that all the entries are seen, as if you just print out the form, it seems as though you will only print the data that is viewable. (i.e. if you have a scroll bar, the lower items will not be printed).

I suppose that the best way to do this will be as your linked suggestion, by creating a report for the data, but I would prefer to get this solution working as a learning curve..

Thanks.
 
try adding a line like this
ComboBoxName.setfocus
before the print
where comboboxname is the name of a control on the detail part
 
I don't know why DoCmd.PrintOut doesn't work for you. I created a form that contained a header, footer, and detail section. Placed the print command button in the footer and issued your command. It printed all 3 sections.

I think you will have to go the report route to do what you want with the list box.
 
As for the list box. Set up you combo box and in properties set it to display – screen only
Now make a list box big enough to display all of your details with the same link as the list box. Set this to display – print only and place it exactly over the combobox.

The combo box with the selected value will display on screen , when you print the list box with all values will be displayed J
 
I solved the resizing of the list box with the following code:

Code:
Dim intListC
Dim i As Integer, curTotal As Currency
Static intListCount As Integer

Me.lstComponents.Requery
Me.txtTot.Requery
'MsgBox Me.InsideHeight

'setup default listbox size
If Me.lstComponents.ListCount > 45 Then
    intListC = 45
Else
    intListC = Me.lstComponents.ListCount
End If

If 213 * Me.lstComponents.ListCount > 2948 Then 'setting maximum size of form with 1024x768 resolution
    Me.lstComponents.Height = (213 * intListC) + 10 ' set a few pixels more to remove the scroll bar
    Me.Detail.Height = (213 * intListC) + 20
    Me.InsideHeight = Me.Detail.Height + 1792
Else
    Me.lstComponents.Height = (213 * intListC) + 10
    Me.Detail.Height = 2948
    Me.InsideHeight = Me.Detail.Height + 1792
End If

I found that the height of each row in the list box was about 213 twixels, so the listbox is resized for the amount of rows * 213.. If you use this code, you may want to ensure that your form is PopUp = Yes so that it can expand out of the main access window..

I still haven't got the printing sorted tho..
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top