Ms access чем посмотреть pdf файл

от admin

Access 2007 — просмотр содержимого PDF на форме

В Access 2007 существует ли способ отображения содержимого PDF, даже если это только первая страница, в форме? Этот PDF файл сохраняется в таблице в виде вложения.

Отказ от ответственности: этот ответ будет работать только для файлов PDF, хранящихся вне вашей базы данных, в виде отдельного файла. Они могут быть расположены по сетевому соединению, но я не знаю, как обращаться к ним непосредственно из таблицы базы данных. Этот сайт дает подробное руководство по использованию вложений, но не показывает, как фактически отображать их автоматически. Вероятно, функциональность не предоставляется Access.

Вы можете отображать все, что Internet Explorer может отображать с помощью элемента управления Microsoft Web Browser .

После того, как вы добавили элемент управления, вы можете перейти к тому, что хотите отображать во время загрузки или открывать событие формы.

Например, если элемент управления называется WebBrowser0 , тогда будет работать следующее:

Это чрезвычайно универсальный метод отображения другого содержимого в Access. Вы можете найти более подробную информацию здесь.

How to attach and view pdf documents to access database

I have a very simple database in access, but for each record i need to attach a scanned in document (probably pdf). What is the best way to do this, the database should not just link to a file on the pc, but should copy and keep the file with it, meaning if the original file goes missing the database is moved or copied, the file should still be accessable from within the Database. Is This possible? and what is the easiest way of doing it? If is should i can write a macro, i just dont know where to start. and also when i display a report of the table, i would like to just see thumbnails of the documents. Thank you.

3 Answers 3

As the other answerers have noted, storing file data inside a database table can be a questionable practice. That said, I wouldn’t personally rule it out, though if you are going to take that option, I’d strongly suggest splitting out the file data into its own table in its own backend file. For example:

  • Create a new database file called Scanned files.mdb (or Scanned files.accdb ).
  • Add a single table called Scans with fields such as FileID (AutoNumber, primary key), MainTableID (matches whatever is the primary key of the main table in the main database file), FileName (Text), FileExt (Text) and FileData (‘OLE object’, really just a BLOB — don’t actually use OLE Objects because they will bloat the database horribly).
  • Back in the frontend, add a reference to Scans as a linked table.
  • Use a bit of VBA to upload and extract files from the Scans table (if you’re interested in the mechanics of this, post a separate question).
  • Use the VBA Shell routine (if you must) or ShellExecute from the Windows API (= the better option IMO) to open extracted data.

If you are using the newer ACCDB format, then you have the ‘attachment’ field type available as smk081 suggests. This basically does most of the above steps for you, however doing things ‘by hand’ gives you greater flexibilty — for example, it allows giving each file a ‘DateScanned’ or ‘DateEffective’ field.

That said, your requirement for thumbnails will require explicit coding whatever option you take. It might be possible to leverage the Windows file previewing API, though I’d be certain thumbnails are a definite requirement before investigating this — Access VBA is powerful enough to encourage attempts at complex solutions, but frequently not clean and modern enough to allow fulfilling them in a particularly maintainable fashion.

Читать:
Как соединить строки в sql

Как открыть PDF-файл, хранящийся в поле [изображение] sql server, с помощью ms Access 2007

Я конвертирую базу данных из доступа к интерфейсу доступа к серверу sql. В базе данных есть встроенные PDF-документы, которые в конечном итоге сохраняются как данные [изображения] с помощью инструментов импорта данных SQL-сервера.

Моя проблема в том, что я хочу, чтобы пользователи могли открывать файл PDF, щелкнув значок PDF в отчете, созданном при доступе.

Можно ли это сделать с помощью VBA или есть более простой способ? Я совершенно не понимаю, как это сделать.

Спасибо за ответ!

Я отредактировал функцию BlobToFile, чтобы удалить заголовок ole, поскольку Adobe не мог прочитать файл (evince мог, а также предварительный просмотр для Mac)

Я мог делать то, что хотел, вот так:

В StackOverflow нельзя повторять вопросы. Это не традиционный форум. Предлагаю вам удалить другой вопрос: stackoverflow.com/questions/8072133/… — HK1

1 ответы

Если я понимаю, что вы пытаетесь сделать, вы в основном хотите, чтобы Adobe Reader открывал «объект» файла pdf в памяти. Это невозможно. Вам нужно будет записать PDF-файл на системный жесткий диск, а затем открыть его оттуда. Вы можете в некоторой степени добиться того, о чем просите, либо используя папку Temp на компьютере, либо самостоятельно управляя файлами / папкой. Например, вы можете очищать папку с файлами PDF каждый раз, когда открывается приложение.

Вот код, который поможет вам делать то, что вы пытаетесь сделать. Этот код не обрабатывает ничего, что связано с созданием папок, генерацией имен файлов, проверкой, существует ли уже файл и т. Д. Я предполагаю, что вы сможете справиться с этим. Мой код в Command1_Click предполагает, что вы используете SQL Server со связанными таблицами ODBC.

Я использую здесь FollowHyperlink, но настоятельно рекомендую вам использовать Функция GoHyperlink Аллена Брауна вместо того, чтобы открывать файлы. У вас, вероятно, будут ошибки безопасности с FollowHyperlink.

Не тот ответ, который вы ищете? Просмотрите другие вопросы с метками sql-server ms-access vba or задайте свой вопрос.

How to open pdf documents from a Microsoft Access Form

Member Avatar

hi friends!
From my Microsoft Access form I would like to hyperlink to a pdf document. At present each record contains a document name and a full file path to where the document is stored. I would like to open adobe Reader and view the specified document.

please give me tips regarding this.If possible explain with codes.
Thanku in advance.

  • 4 Contributors
  • 3 Replies
  • 3K Views
  • 5 Years Discussion Span
  • Latest Post 9 Years Ago Latest Post by daniROC

Member Avatar

Hi, to do this, insert a hyperlink by pressing ctrl + k, and then select the file you want to open, but make sure u dont change the location of the pdf file after uve created the hyperlink.

hope this helps

Member Avatar

This opens your file with the default registered program in Windows.

Put this in a bas module (in 1 line):

Public Declare Function ShellExecute Lib «shell32.dll» Alias «ShellExecuteA» (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Public Const SW_SHOW = 1

‘***********************************
‘Put this in a command button in your form

Related Posts