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
Juri AlsayighCO-OPAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Databases

From novice to tech pro — start learning today.