Link to home
Start Free TrialLog in
Avatar of Juri Alsayigh
Juri Alsayigh

asked on

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
Avatar of Sam Simon Nasser
Sam Simon Nasser
Flag of Palestine, State of image

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

ASKER CERTIFIED SOLUTION
Avatar of Anders Ebro (Microsoft MVP)
Anders Ebro (Microsoft MVP)
Flag of Denmark image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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.