Full Version: print form
UtterAccess Forums > Microsoft® Access > Access Forms
velocity
I am trying to print out the current record of a form with a button. The problem is when I click the button it prints out ALL the records and not just the one that is currently on the screen. here is my code.
Private Sub Command231_Click()
On Error GoTo Err_Command231_Click

DoCmd.PrintOut
Exit_Command231_Click:
Exit Sub
Err_Command231_Click:
MsgBox Err.Description
Resume Exit_Command231_Click

End Sub
What do I need to add to only print out the current record that I am viewing?
thanks,
Steve
Doug Steele
Realistically, forms aren't intended for printing: that's what reports are for. Fortunately, Access allows you to create reports based on forms: simply select the form in the database window, right-click on it and select Save As Report.
nce you've got the appropriate report, you can use the OpenReport method, passing it an appropriate WhereCondition to limit it to the current record.
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.