Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Automatically populating code with query out put.

Status
Not open for further replies.

shadyness

MIS
Dec 21, 2001
89
US
I have a small (60 mb) Access 2000 base I developed for a state agency that resides on their network. In a separate folder on the same network, there are around 20 gigs worth of scanned invoices in PDF format. The Access base archives the documents (with an individual description and document title) and the user can call up an individual PDF by clicking on the document hyperlink that refers to a PDF in the separate folder on the network. I developed a "keyword" type search mechanism, where the user could look up all of the documents with relevance to, say an individual company for instance. The Access query will then list the number of documents and their corresponding PDF hyperlinks in the form screen, like a list of "hits". The program can print a PDF file by using this code:
Code:
'---------------------------------------------------------- 
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long 

Private Sub Command1_Click() 
ShellExecute 0, "PRINT", "C:\SomePDF.pdf", "", "", 1 
End Sub 
'----------------------------------------------------------
MY QUESTION IS, What would be the best way to ShellExecute multiple pathways, that are produced by a query? For, instance a "print all" button, that would print all of the PDF files that the listed hyperlinks refer to . . . Thanks

ian@everynobody.com
 
Thats is stictly a design decision. If you get a list of filenames loop through them with the print command at the core when the user clicks the cmdPrintAll command button.

Loop through ...
Recordsets created from the return of a query
Arrays created from whatever
Dir() loop looking at a directory
A string with delimited filenames


----------------------
scking@arinc.com
Life is filled with lessons.
We are responsible for the
results of the quizzes.
-----------------------
 
One Problem remains,

The hyperlinks are shortened, so that the ShellExecute code requires "R:\Some Folder\" to proceed the hyperlinks that would be returned by the query. What I would like to see occur in the onclick event of the "print all" button would be:
Code:
Private Sub Command59_Click()
On Error GoTo Err_Command59_Click

'HERE I need to decide how we want to grab the field from the query 
'Then paste the hyperlink with the words "R:\Some Folder\" proceeding every result and loop the below statement with the new pathway pasted in the place of "+++"

ShellExecute 0, "PRINT", "+++", "", "", 1

'End the LOOP

Exit_Command59_Click:
    Exit Sub

Err_Command59_Click:
    MsgBox Err.Description
    Resume Exit_Command59_Click
    
End Sub
I am lost as far as how to place the text in front of the hyperlink inside of VB script, and then past that new calue into the statement so that it will loop.

Any pointers?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top