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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How di I print a hyperlink from within a report

Status
Not open for further replies.

toptech

Programmer
Apr 12, 2001
71
US
Hi There.

I have a hyperlink address stored in a field of a table.

When I print the rest of the info of the record, I also need to print the actual document that the hyperlink is pointing to.

Does anyone have any ideas of how I can trigger the printing of the hyperlinked file.


Thanks in advance.

Jeff
Top Tech Systems

Top Tech Systems

If you help 3 people and each one of those help 3 other people and so on, imagine all the people being helped.
 
What kind of document is the hyperlink pointed?

AccessGuruCarl
Programmers helping programmers
you can't find a better site.
 



It is a diagram of machine parts.

All diagrams would be located in a specific folder on the server.

Thanks,

Jeff


Top Tech Systems

If you help 3 people and each one of those help 3 other people and so on, imagine all the people being helped.
 
Did this not work for you?
Printing a HYPERLINK
thread703-1227195
 
What format is the diagrams?

bmp, jpg, cad.....

Without knowing what you trying to open, we can't help!

If it's an image that will open in MSPaint, Take a look at Remou post. It should work just fine!

Carl

AccessGuruCarl
Programmers helping programmers
you can't find a better site.
 

Hi There.

Each diagram will be in its own pdf file.

Thanks,

Jeff

Top Tech Systems

If you help 3 people and each one of those help 3 other people and so on, imagine all the people being helped.
 
Hi toptech,

Paste this code into a new module.
Code:
Public 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

Public Sub PrintHyperLink(strLink As String)
    Dim retval As Long
    retval = ShellExecute(0, "print", strLink, "", "", 0)
End Sub

Then to call it. Add this code to the OnPrint Event

Code:
Dim hFile As String
Dim y
'If the control is a hyperlink... You need to remove the # symbols
y = Len(Me.txtHyperlink)
hFile = Mid(Me.txtHyperlink, 2, y - 2)

Call PrintHyperLink(hFile)

I found this code right here on Tek-Tips...
Advanced Search - Printing PDF files with VBA
Then modified it for your needs.
Hope this works out!

Carl

AccessGuruCarl
Programmers helping programmers
you can't find a better site.
 

Hi Carl.

Thanks for your help.

I'll give it a whirl.

Cheers.

Jeff

Top Tech Systems

If you help 3 people and each one of those help 3 other people and so on, imagine all the people being helped.
 
No problem,

FYI..
The hyperlink field must be the full path and file name!

Post any problems or let me know if it worked!

Carl

AccessGuruCarl
Programmers helping programmers
you can't find a better site.
 
Hi Carl.

Everything prints out fine when printing to paper.

However, when I print to PDF, the report prompts me twice for te sving of the pdf.

The first prompt is for first portion of my regular report,
the second prompt is for the hyperlink file.

I would like to save the whole thing in 1 pdf.

IE. the first part of my report should be page 1 and the hyperlink print should be page 2.

Both to be saved in the one pdf.
Therefore, there should only be one prompt, not two.

Hope you can help.

Thanks,

Jeff



Top Tech Systems

If you help 3 people and each one of those help 3 other people and so on, imagine all the people being helped.
 
Are you using a professional version of Acrobat?
Is distiller installed?
I don't think you can append pages in the basic version.

As for the prompts, you can choose whether to see these by adding a true/false in your statement.

Do you have a reference set to Acrobat in your code, or are you just sending these to the adobe printer?
You can try saving it, close it, then reopen and try adding a new page.

Try looking in the Acrobat Section ,Adobe, or MS Access for 'setting a reference to Acrobat in MS Access', you should find plenty of examples for using adobe.

I'll see if I have my code still laying around that opened an excel file, then saved parts of it as a pdf file. This was a one time deal, that looped a folder, so I might not have it, I checked my threads & reply's and didn't find anything there. Which makes me believe I found exactly what I needed in a search. I'll check with the user, to see if it's still laying around on his hardrive! If you can't find anything, let me know.



AccessGuruCarl
Programmers helping programmers
you can't find a better site.
 

Hi Carl.

Thanks,

I'll try to find it.

If you find something, please forward it to me.

Regards,

Jeff

Top Tech Systems

If you help 3 people and each one of those help 3 other people and so on, imagine all the people being helped.
 
Hi Carl.

I have not been able to find anything that works.

I still get the prompt to save twice.


Regards,

Jeff


Top Tech Systems

If you help 3 people and each one of those help 3 other people and so on, imagine all the people being helped.
 
Post your code, so i can see what you got.

The user I orginally wrote this for does not have a copy anymore. I'll look through my samples again, to see if I kept anything related.

AccessGuruCarl
Programmers helping programmers
you can't find a better site.
 
check this link out..


Scroll down to the code...
I need to be doing something along this line.....

Also check the very next post about the options in acrobat for prompting for filenames. And maybe the last post.





AccessGuruCarl
Programmers helping programmers
you can't find a better site.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top