inserting .pdf documents

J

jeremy0028

I would like to know if theres a way to insert or store .pdf documents
into access and view the file the way you insert and pics.

For Example i have the following code in my command button for
inserting pics but dont know how to write code for .pdf documents


Thanks In advance

Private Sub cmdInsertPic_Click()
Dim OFN As OPENFILENAME
On Error GoTo Err_cmdInsertPic_Click

' Set options for dialog box.
With OFN
.lpstrTitle = "Images"
If Not IsNull([PicFile]) Then .lpstrFile = [PicFile]
.flags = &H1804 ' OFN_FileMustExist + OFN_PathMustExist +
OFN_HideReadOnly
.lpstrFilter = MakeFilterString("Image files
(*.bmp;*.gif;*.jpg;*.wmf)", "*.bmp;*.gif;*.jpg;*.wmf", _
"All files (*.*)", "*.*")
End With

If OpenDialog(OFN) Then
[PicFile] = OFN.lpstrFile
Forms!frmPicExample!picsubform![imgPicture].Picture = [PicFile]
SysCmd acSysCmdSetStatus, "Afbeelding: '" & [PicFile] & "'."
End If
Exit Sub

Err_cmdInsertPic_Click:
MsgBox Err.Description, vbExclamation
End Sub
 
P

pietlinden

I would like to know if theres a way to insert or store .pdf documents
into access and view the file the way you insert and pics.

For Example i have the following code in my command button for
inserting pics but dont know how to write code for .pdf documents

Thanks In advance

Private Sub cmdInsertPic_Click()
Dim OFN As OPENFILENAME
On Error GoTo Err_cmdInsertPic_Click

' Set options for dialog box.
With OFN
.lpstrTitle = "Images"
If Not IsNull([PicFile]) Then .lpstrFile = [PicFile]
.flags = &H1804 ' OFN_FileMustExist + OFN_PathMustExist +
OFN_HideReadOnly
.lpstrFilter = MakeFilterString("Image files
(*.bmp;*.gif;*.jpg;*.wmf)", "*.bmp;*.gif;*.jpg;*.wmf", _
"All files (*.*)", "*.*")
End With

If OpenDialog(OFN) Then
[PicFile] = OFN.lpstrFile
Forms!frmPicExample!picsubform![imgPicture].Picture = [PicFile]
SysCmd acSysCmdSetStatus, "Afbeelding: '" & [PicFile] & "'."
End If
Exit Sub

Err_cmdInsertPic_Click:
MsgBox Err.Description, vbExclamation
End Sub

What you propose is considered a bad idea. Your database will bloat
very quickly. You would be better off to use the FileOpen API to grab
the filename of the PDFs you're cataloging and then maybe displaying a
hyperlink (store it as TEXT), then you should have the same
functionality without the bloat. If you need to share this database,
you should store the UNC path to the file, and not the mapped drive
information. Then you won't have nightmares when you have to move the
database around and dealing with mapped drive letters and all that
nonsense.

You may want to play with BrowseFolder API and the OpenSaveFile API,
Both of them are at www.mvps.org in the Modules section.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top