Code for print report select from list box (1 Viewer)

Sokkheng

Member
Local time
Tomorrow, 05:17
Joined
Jul 12, 2023
Messages
34
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.
 

Gasman

Enthusiastic Amateur
Local time
Today, 23:17
Joined
Sep 21, 2011
Messages
14,310
Why not Google for the syntax?


 

theDBguy

I’m here to help
Staff member
Local time
Today, 15:17
Joined
Oct 29, 2018
Messages
21,474
Can you tell us what error message you're getting?
 

apr pillai

AWF VIP
Local time
Tomorrow, 03:47
Joined
Jan 20, 2005
Messages
735
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
 

Sokkheng

Member
Local time
Tomorrow, 05:17
Joined
Jul 12, 2023
Messages
34
thanks for reply, for preview report is ok, it have problem only for print report when i click it do nothing.
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 18:17
Joined
Feb 19, 2002
Messages
43,288
It is difficult enough to debug code we can see but virtually impossible when the code is invisible.
 

Users who are viewing this thread

Top Bottom