472,373 Members | 1,547 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,373 software developers and data experts.

Saving PDF file as an OLE object in a database

74
I have been trying to figure this out for some time now.

Currently i have a code that changes the default printer to a PDF printer, it then takes the name of a field in my form and changes the name of a report to that field then prints, i get the PDF file so i can email out BUT i want to save that PDF file as an Ole object on one of my tabels for later referance but i dont know how to go about this.

thanks in advance for your help.
Apr 9 '07 #1
14 19173
Denburt
1,356 Expert 1GB
I have mentioned this in several articles recently and thought I would let you know that if you are storing OLE objects in a field in your table you could be asking for serious trouble. MS Access has a 2 gig limit so if you take this approach then keep this in mind, OLE objects tend to increase the size of your DB in a major way. I did find the following thread this thread has a link which should guide you in the direction you want.

http://www.thescripts.com/forum/thread205446.html
Apr 9 '07 #2
Hutch
74
how would i go about saving these "PDF" files in a seperate folder on the server then creating a link between a field in my table to that particular file inside the folder?
Apr 10 '07 #3
pks00
280 Expert 100+
How many pdf's are you likely to store. I dont see a problem too much so as long as its not too many. But I dont store as ole objects, instead I store them as blobs.
One app of mine has a few wave files used when certain thresholds are hit. The way I store this is in a table in Access as blobs. I then use code to read and save onto the user's PC

If shedloads then u should as already suggested, store a path to the file.

Where are you storing these pdf's?
What u need to do is each time u create a pdf, store that name in some table
eg
tblPDFs
ID (autonumber)
Name (name of pdf)

assume pdf's are all in one directory, if not then u need to store the path as well

now in your other table, u can store the ID. That is the link to the pdf
Apr 10 '07 #4
Hutch
74
I use a form to pull several different types of information from several tables and then record that information onto another table to creat a "quote" i then print it as a PDF i have about 2000 PDF's right now. and currently i have to go out onto the server through folder to find the PDF quote to email out, i want a field in my "QUOTE" table that links the PDF to a command button that will bring it up. i have it all figured out but the actuall link. i dont know how to set that value.
Apr 10 '07 #5
Denburt
1,356 Expert 1GB
I have been trying to figure this out for some time now.

Currently i have a code that changes the default printer to a PDF printer, it then takes the name of a field in my form and changes the name of a report to that field then prints, i get the PDF file so i can email out BUT i want to save that PDF file as an Ole object on one of my tabels for later referance but i dont know how to go about this.

thanks in advance for your help.
Can we see some of this code? Does the code specify where to put the PDF's? Do the PDF's print to some random location each time? You should be able to tell the PDF's where to print to, and once you do that then you can just store the path and off ya go.

I have a contract database that stores PDF's as hyperlinks so they can click on it and actually see the contract. My version uses a dialog box to locate the contracts then store the path.
Apr 11 '07 #6
Hutch
74
Set Application.Printer = Application.Printers("Quote - PDF")

this is the code to get the printer to switch over, the printer is specified to print to a certain folder on the server. another funny thing is all the files get printed in black and white even through all the settings on the printer are correct, althoguh i'm not stressing over this part i thought you might be able to shed some light on the subject. thanks
Apr 12 '07 #7
Denburt
1,356 Expert 1GB
the printer is specified to print to a certain folder on the server
Since you know the path, and you probably know the file name simply store that info in a hyperlink field and off you go.

Me!SomeHyperField = "\\ServerName\Folder\FileName.pdf

I will see if I can find anything on the black and white issue.
Apr 12 '07 #8
Hutch
74
Since you know the path, and you probably know the file name simply store that info in a hyperlink field and off you go.

Me!SomeHyperField = "\\ServerName\Folder\FileName.pdf

I will see if I can find anything on the black and white issue.

should i take it the "somehyperfield" is the name of the field on my table
Apr 12 '07 #9
Denburt
1,356 Expert 1GB
Yes sir once you set it as a Hyperlink field in your table then set the path/filename they can click on it and it will open the pdf so they can view it.
Apr 12 '07 #10
Hutch
74
Since you know the path, and you probably know the file name simply store that info in a hyperlink field and off you go.

Me!SomeHyperField = "\\ServerName\Folder\FileName.pdf

I will see if I can find anything on the black and white issue.
i recieve an "Invalid procedure call" on this
Apr 17 '07 #11
Denburt
1,356 Expert 1GB
i recieve an "Invalid procedure call" on this
Ah yes brain isn't what it used to be my appologies:

Hyperlink
Expand|Select|Wrap|Line Numbers
  1. Private Sub cmdFollowLink_Click()
  2.     CreateHyperlink Me!cmdFollowLink, Me!txtSubAddress, _
  3.          Me!txtAddress
  4. End Sub
  5.  
  6. Sub CreateHyperlink(ctlSelected As Control, _
  7.      strSubAddress As String, Optional strAddress As String)
  8.     Dim hlk As Hyperlink
  9.     Select Case ctlSelected.ControlType
  10. 'I added textBox because thats what I use (storing it in a table this makes it easier)
  11.         Case acLabel, acImage, acCommandButton,TextBox
  12.             Set hlk = ctlSelected.Hyperlink
  13.             With hlk
  14.                 If Not IsMissing(strAddress) Then
  15.                     .Address = strAddress
  16.                 Else
  17.                     .Address = ""
  18.                 End If
  19.                 .SubAddress = strSubAddress
  20.                 .Follow
  21.                 .Address = ""
  22.                 .SubAddress = ""
  23.             End With
  24.         Case Else
  25.             MsgBox "The control '" & ctlSelected.Name _
  26.                  & "' does not support hyperlinks."
  27.     End Select
  28. End Sub
  29.  
Apr 20 '07 #12
Hutch
74
Could you help me understand the first part of this Code? I'm having difficulty understanding the "ME" commands.

Thanks in advance
May 1 '07 #13
Denburt
1,356 Expert 1GB
Could you help me understand the first part of this Code? I'm having difficulty understanding the "ME" commands.

Thanks in advance
Me is a reference to the form or report you are currently coding in.
Simply two text boxes storing information about the link and a button that directs you. If you check the link I posted it should help you understand the hyperlink code I posted a little better.
May 1 '07 #14
AVA75
1
I know it's a little too late to ask something about this subject, but it's kinda related.

I would like to know if there's any easy way to change a field (OLE OBJECT) in a table to HYPERLINK.

We have a database that has PDF embedded and of course, the size increased upto the 2 gigas limit.

Is there any way to change that or we just have to migrate everything to SQL Server?

Thank you very much!
Jul 14 '08 #15

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: simon place | last post by:
is the code below meant to produce rubbish?, i had expected an exception. f=file('readme.txt','w') f.write(' ') f.read() ( PythonWin 2.3 (#46, Jul 29 2003, 18:54:32) on win32. ) I got...
1
by: Matthew Wilson | last post by:
I have a bunch of classes that track data for time series. The classes are really just glorified dicts where the key is a date object, and the value is the value as of that date. I want a way...
2
by: Duy Nguyen | last post by:
how can I save an image file to database?
7
by: mfozdar_mca | last post by:
Dear sir I m Software Engineer in Software co. My question is how do i Store OLE Object (JPG) file to database AppendChunk plz Help me
0
by: lipsa | last post by:
i want 2 write arnd 2 lakh rows of data(16 columns)data in a pipe separated text file from database(sql server) .(its the need ,cant help) i m using recordset/file system object. its taking a...
9
by: sc_wizard29 | last post by:
Hi everyone, Maybe these questions will sound strange to you, but I sometime have a hard time switching from Java to Python ;-) Let's say I have a function like this : def show_lines(file):...
9
by: TC | last post by:
Like a lot of database developers, I often choose Jet for the back- end. I'm starting to worry about what will happen when Jet is deprecated. Ostensibly, Jet users like me must switch to SQL Server...
2
by: Thomas Ploch | last post by:
Hello folks, I am currently developing an open source Event Managment software (events in real-life, like concerts, exhibitions etc. :-) ) using wx for the GUI, and I need an Object database....
3
by: tshad | last post by:
I have a file that I want to upload periodically from a users machine if they come back later. I am storing the filename and path in my database. But the HtmlInputFile normally file is set to...
5
by: JohnLorac | last post by:
Hello, can somebody help me with saving file into local disk using javascript? I made some sample code which unfortunately won't work :(. Applet sample file: public class IO extends...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge required to effectively administer and manage Oracle...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific technical details, Gmail likely implements measures...
1
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web server and have made sure to enable curl. I get a...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the synthesis of my design into a bitstream, not the C++...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand. Background colors can be used to highlight important...
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python has gained popularity among beginners and experts...
2
by: Ricardo de Mila | last post by:
Dear people, good afternoon... I have a form in msAccess with lots of controls and a specific routine must be triggered if the mouse_down event happens in any control. Than I need to discover what...
1
by: Johno34 | last post by:
I have this click event on my form. It speaks to a Datasheet Subform Private Sub Command260_Click() Dim r As DAO.Recordset Set r = Form_frmABCD.Form.RecordsetClone r.MoveFirst Do If...
0
DizelArs
by: DizelArs | last post by:
Hi all) Faced with a problem, element.click() event doesn't work in Safari browser. Tried various tricks like emulating touch event through a function: let clickEvent = new Event('click', {...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.