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
202 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

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

It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
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.
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

732 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