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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Most if not all databases provide tools to filter data; even simple mail-merge programs might offer basic filtering capabilities. This is so important that, although Access has many built-in features to help the user in this task, developers often n…
QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…

758 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

18 Experts available now in Live!

Get 1:1 Help Now