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
193 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

910 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now