473,503 Members | 4,234 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Saving PDF file as an OLE object in a database

74 New Member
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 19449
Denburt
1,356 Recognized Expert Top Contributor
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 New Member
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 Recognized Expert Contributor
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 New Member
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 Recognized Expert Top Contributor
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 New Member
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 Recognized Expert Top Contributor
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 New Member
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 Recognized Expert Top Contributor
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 New Member
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 Recognized Expert Top Contributor
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 New Member
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 Recognized Expert Top Contributor
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 New Member
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
10127
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
1493
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
2154
by: Duy Nguyen | last post by:
how can I save an image file to database?
7
12564
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
1403
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
5822
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
2994
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
1089
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
1089
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
6412
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
7193
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
1
6975
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7449
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
4992
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4666
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3160
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3148
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
728
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
371
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.