By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,956 Members | 1,874 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,956 IT Pros & Developers. It's quick & easy.

Viewing scanned documents in access

P: 4
I would like some advice on how to link scanned documents to specific records in microsoft access
May 11 '07 #1
Share this Question
Share on Google+
9 Replies


JConsulting
Expert 100+
P: 603
I would like some advice on how to link scanned documents to specific records in microsoft access
1) What kind of documents are they? PDF?
2) When you say link..you mean put the path in a field in the table so you can click it and it will open the document?
3) How do you plan to help your user to get the path in the field?

you can set up a field in a table as hyperlink. A path like C:\myfile.pdf when clicked on will open the PDF as long as you have an acrobat viewer installed. This works for most file types known to MS (as long as you have the supporting software to open them)

J
May 12 '07 #2

P: 4
I want to link a specific value in a field to a PDF file that is named the same as the value in the field. So each entry for that field will bring up a different image. This is my first time posting and I don't have a programming background so I am struggling a little on this one.
May 14 '07 #3

JConsulting
Expert 100+
P: 603
I want to link a specific value in a field to a PDF file that is named the same as the value in the field. So each entry for that field will bring up a different image. This is my first time posting and I don't have a programming background so I am struggling a little on this one.
So you don't want to open the PDF, you want to display it in a form or something?
May 14 '07 #4

P: 4
So you don't want to open the PDF, you want to display it in a form or something?
Yes, that's what I'm after displaying the image in the form. Not sure how to go about it though
May 15 '07 #5

JConsulting
Expert 100+
P: 603
Yes, that's what I'm after displaying the image in the form. Not sure how to go about it though
Morning,
In access, there is an object on the menu that allows you to insert an image. Without stating the obvious, this is an image control. The image control has a property that can be assigned to a control source.

Initially, the easiest thing to do is select the control off the menu. Create one on your form. A wizard will open up allowing you to select your image file. Select one.

Once you get the image control on the form, you can assign it a field in your underlying table.

Your table should hold a path to your images. Normally this path is either the same directory as the one where you plan to install your database, or a subfolder of it. This is for ease of use.

A text field in your table would then hold that path.
example: C:\MyDatabaseLocation\Images\Image1.bmp

Then using the form's On_Current event you assign the image control the value in that text field.

Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Current()
  2. Me.ImageControl.Picture = Me.MyImagePath
  3. End Sub 
  4.  
J
May 15 '07 #6

JConsulting
Expert 100+
P: 603
Yes, that's what I'm after displaying the image in the form. Not sure how to go about it though
your other option, if you don't have images of your pdf documents, is to display them in an unbound OLE object. Below is an example of the types of files you can display in various "frames"

Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Current()
  2. ' OleUnbound11 is an unbound Object Control. It's properties allow you to do the following.
  3. Dim OLEType As String
  4. OLEType = Right(Me.MyOLE, 3)
  5. Select Case OLEType
  6. Case "pdf"
  7. 'Me.OLEUnbound8.SourceItem = Me.MyOLE
  8.     Me.OLEUnbound11.Class = "AcroExch.Document"    ' Set class name. if you leave the version out...it defaults to the latest
  9. Case "bmp"
  10.     Me.OLEUnbound11.Class = "Paint.Picture"    ' Set class name. if you leave the version out...it defaults to the latest
  11.     ' Adjust control size.
  12.     'Me.OLEUnbound11.SizeMode = acOLESizeStretch
  13.     Me.Image0.Picture = Me.MyOLE ' This is an Unbound Image frame..Works differently than an object frame
  14. Case "xls"
  15.     Me.OLEUnbound11.Class = "Excel.Sheet"    ' Set class name. if you leave the version out...it defaults to the latest
  16.     ' Specify data to create link to.
  17.     Me.OLEUnbound11.SourceItem = "R1C1:R5C5"  '<---set the range to what you want to see
  18. End Select
  19.     ' Specify type of object.
  20.     Me.OLEUnbound11.OLETypeAllowed = acOLEEither
  21.     ' Specify the verb action
  22.     Me.OLEUnbound11.Verb = acOLEVerbOpen ' -2 = acOLEVerbOpen
  23.     ' Specify source file.
  24.     Me.OLEUnbound11.SourceDoc = Me.MyOLE  '<----My field
  25.     ' Specify data to create link to.
  26.     Me.OLEUnbound11.Action = 0 ' 1 = acOLECreateLink, 0 = acOLECreateEmbed
  27.     ' Adjust control size.
  28.     Me.OLEUnbound11.SizeMode = 1  'acOLESizeClip (0), acOLESizeStretch (1), acOLESizeZoom (3)
  29.     Me.Dirty = False
  30.     Me.OLEUnbound11.Requery
  31.     Me.Refresh
  32. End Sub
  33.  
May 15 '07 #7

P: 4
thanks i'll give it a go
May 17 '07 #8

P: 3
I need to embed a PDF file into my DB. Based on the client's business rules I cannot maintain the document outside of the DB. I cannot therefore link to a given location outside of the database.

The code that I am using, which I have confirmed from several different sites, is as follows:

------- Code used ----------------------------------------
varFile = "C:\PDFForms\ImportedFile.pdf"

On Error GoTo Error_cmdOleAuto_Click
Forms![PDFForm]![DocTypeID] = 13
Forms![PDFForm]![DocSubject] = "My new PDF document"
With Forms![PDFForm]![embeddedDoc]
.Enabled = True
.Locked = False
.OLETypeAllowed = acOLEEmbedded
.Class = "AcroExch.Document"
.SourceDoc = varFile
.Action = acOLECreateEmbed <-- Error generated here
End With
DoCmd.RunCommand acCmdSaveRecord

----------- Errors received --------------
?cstr(err)
2777

?Err.Description
The class argument in the CreateObject function of the Visual Basic
procedure you're trying to run is invalid.
---------------------------------------

I receive the listed errors when running this code.

All of the examples listed on all of the searches I have performed so far point me to the use of a .JPG or other image. These work comfortably, but the PDF file gives problems.

I have tried ignoring the .CLASS argument, but it still returns errors.

There are a heap of other discussions, but most tend to recommend saving the document outside of the DB.

Has anyone solved this problem yet?

Can someone please advise me on this one?
Dec 17 '08 #9

P: 3
btw: I am developing in Access 2007, with SQL Server 2005 as the Back End. The PDFs are created using the Office 2007 PDF/XPS add-in util from MS.
Dec 17 '08 #10

Post your reply

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