Solved

Query returns more than one hyperlink report to print.  How can I print all the ones it finds?

Posted on 2011-02-16
5
200 Views
Last Modified: 2012-05-11
I have one or more pdf documents linked to a form, but my code will only print one of the documents, not all.  What do I need in order to print all the documents the query finds on this command button?  

Private Sub prtndt_Click()
On Error GoTo Err_prtndt_Click

Dim qd As Long

qd = DCount("*", "qryLinkedDocuments", "det_id=" & Me!ID)
If qd > 0 Then
  
 strfile = DLookup("ImagePath", "qrylinkeddocuments", "det_id=" & Me!ID)
 ShellExecute Me.hwnd, "open", strfile, Chr$(0), strPath, 3
 
Else

MsgBox "There are no NDTs to print.", vbOKOnly

End If

Exit_prtndt_Click:
    Exit Sub

Err_prtndt_Click:
    MsgBox Err.Description
      Resume Exit_prtndt_Click
    
End Sub

Open in new window

0
Comment
Question by:bwestly
  • 3
  • 2
5 Comments
 
LVL 13

Accepted Solution

by:
Surone1 earned 500 total points
ID: 34912737
set rs = currentdb.openracordset('select * from qrylinkeddocuments where det_id= " & Me!ID)
do while not rs.eof
strfile = rs.fields("imagepath").value
ShellExecute Me.hwnd, "open", strfile, Chr$(0), strPath, 3
rs.movenext
loop
0
 
LVL 13

Expert Comment

by:Surone1
ID: 34912751
set rs = currentdb.openrecordset('select * from qrylinkeddocuments where det_id= " & Me!ID)
0
 
LVL 13

Expert Comment

by:Surone1
ID: 34912755
set rs = currentdb.openrecordset("select * from qrylinkeddocuments where det_id= " & Me!ID)
0
 

Author Comment

by:bwestly
ID: 35034015
Sorry, Surone1

I didn't get any emails about your answer.  Don't know where they went.  I will check this out tomorrow and let you know if it works.  

Thanks.
0
 

Author Closing Comment

by:bwestly
ID: 35833954
Thank you for the great information.  I'm so sorry it took so long to get back into the problem.  I can print multiple PDFs with no problem now.
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question