How do I add an image to SQL db, and reference it in an access form?

GBalcom

Much to learn!
Local time
Today, 03:16
Joined
Jun 7, 2012
Messages
460
Basically, I need to understand how to store an image, or PDF in an SQL server db, then reference it in Access....ie, show the image in an access form, or print off the PDF.

Thanks!
 
Was looking at this a while back. Have yet to try it, but kept it on file in case I am asked to store PDF. It looks about right. Here is the quote:

We have several databases that contain 10's of thousands of documents (pdf, doc, jpg, ...), no problem at all. In Access, we use the following code to upload a binary object to a binary field:
Code:
Function LoadFileFromDisk(Bestand, Optional FileName As String = "")
  Dim imgByte() As Byte  
If FileName = "" Then FileName = strFileName  
Open FileName For Binary Lock Read As #1  
ReDim imgByte(1 To LOF(1))  
Get #1, , imgByte  
Close #1  
If Not IsEmpty(imgByte) Then Bestand.Value = imgByte
End Function
In this case, Bestand is the field that contains the binary data. We use MS SQL Server as a backend, but the same should work on an Access backend.
 

Users who are viewing this thread

Back
Top Bottom