• Status: Solved
  • Priority: Low
  • Security: Public
  • Views: 47
  • Last Modified:

Access form prints only the header

I am using access to build a database. And I’ve created a form I’ve added a button to print current form. but when I click print it will only print the header of the form
0
Juri Alsayigh
Asked:
Juri Alsayigh
  • 2
1 Solution
 
Sam Simon NasserIT Support ProfessionalCommented:
when you say print the current form, you mean a report? thus you created a report to be filled with that form data?

this is a simple code to print the form data, but depends on a report
Private Sub cmdPrint_Click()
'Print current record
'using rptEmployees.
If IsNull(Me!EmployeeID) Then
MsgBox "Please select a valid record", _
vbOKOnly, "Error"
Exit Sub
End If
DoCmd.OpenReport "rptEmployees", , , _
"EmployeeID = " & Me!EmployeeID
End Sub

Open in new window


here is another code sample
 
Private Sub CommandBtn_Click()
Dim MyForm As Form
    Set MyForm = Screen.ActiveForm
    DoCmd.SelectObject acForm, MyForm.Name, True
    DoCmd.PrintOut
    DoCmd.SelectObject acForm, MyForm.Name, False
 
End Sub
 
 

Open in new window

0
 
Anders Ebro (Microsoft MVP)Microsoft DeveloperCommented:
The general recommendation is often to create a report, and launch the printing of that from the form. But there are several times where I personally find that to be overkill.

You can control whether you want certain elements to be shown "screen only", or "print only", or "always"
This is usefull if e.g. you don't want buttons to show up in the printout, or you might want to hide an internal comment field from the printout. Or you want a label or logo to only show in the printout, but not on the screen.

Most controls have this settings, and the detail section is no exception. Select the detail section, and look under Format properties for the "Display When" setting. I suspect that you have accidentally changed this to "Screen only". (It defaults to Always)
0
 
Sam Simon NasserIT Support ProfessionalCommented:
How did andres assumed his reply was the correct answer? User did not give a feedback!
Either split the point or wait till the user feedback with what solution worked for him.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Improve Your Query Performance Tuning

In this FREE six-day email course, you'll learn from Janis Griffin, Database Performance Evangelist. She'll teach 12 steps that you can use to optimize your queries as much as possible and see measurable results in your work. Get started today!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now