I made a print macro to print records from a subform.
The problem is, it prints all the records in the subform that are not visible aswell. I did a search for records with TSA in it and it shows 3 records. These are the only records I want to print.
The code I use at the moment looks like this:
The problem is, it prints all the records in the subform that are not visible aswell. I did a search for records with TSA in it and it shows 3 records. These are the only records I want to print.
The code I use at the moment looks like this:
Code:
Private Sub Print_Click()
On Error GoTo Err_Print_Click
Dim stDocName As String
Dim MyForm As Form
stDocName = "frmSubform"
Set MyForm = Screen.ActiveForm
DoCmd.SelectObject acForm, stDocName, True
DoCmd.PrintOut
DoCmd.SelectObject acForm, MyForm.Name, False
Exit_Print_Click:
Exit Sub
Err_Print_Click:
MsgBox Err.Description
Resume Exit_Print_Click
End Sub