Code for print report select from list box

Sokkheng

Member
Local time
Tomorrow, 06:45
Joined
Jul 12, 2023
Messages
40
I have create list box (lstReport) that get the list of reports name from table report. now i create a command button for print the report that i select from the list report
DoCmd.PrintOut me.lstReport
But it not working, what problem with my code.
Thanks for any command.
 
Why not Google for the syntax?


 
Can you tell us what error message you're getting?
 
Try out this Code with changes:
Code:
Private Sub Command4_Click()
Dim j As Integer
Dim strReport As String

For j = 0 To List2.ListCount - 1
 If List2.Selected(j) Then
    strReport = List2.Column(0, j)
    DoCmd.OpenReport strReport, acViewReport
 End If
Next
End Sub
 
thanks for reply, for preview report is ok, it have problem only for print report when i click it do nothing.
 
It is difficult enough to debug code we can see but virtually impossible when the code is invisible.
 

Users who are viewing this thread

Back
Top Bottom