473,396 Members | 2,158 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Access 2003 - importing PDF files as part of a record

Greetings all.

I'm building a database (Access 2003) of applicants. Included in this
database I would like to include the PDF applications for individuals
in the database, accessable from a form or table within Access (not a
hyperlink). Any ideas on how to make this work?

Thanks...
Nov 13 '05 #1
2 2249
aaj
Are you looking at extracting the forms details from within the PDF rather
than manipulating the PDF itsself, if so its pretty easy.

Adobe supply a SDK with all the tools, they just need incorporating into a
VBA front end.

hope this gets you started, and I can give you details if you need them

Andy

"Avalanche" <ks******@mappingalaska.com> wrote in message
news:9b**************************@posting.google.c om...
Greetings all.

I'm building a database (Access 2003) of applicants. Included in this
database I would like to include the PDF applications for individuals
in the database, accessable from a form or table within Access (not a
hyperlink). Any ideas on how to make this work?

Thanks...

Nov 13 '05 #2
ks******@mappingalaska.com (Avalanche) wrote in message news:<9b**************************@posting.google. com>...
Greetings all.

I'm building a database (Access 2003) of applicants. Included in this
database I would like to include the PDF applications for individuals
in the database, accessable from a form or table within Access (not a
hyperlink). Any ideas on how to make this work?

Thanks...


If you use the default installation path for Reader you can do
something like:

'Setup code to handle monitoring when Acrobat Reader closes
'Code from Microsoft KB article Q129796
Dim proc As PROCESS_INFORMATION
Dim start As STARTUPINFO
Private Type STARTUPINFO
cb As Long
lpReserved As String
lpDesktop As String
lpTitle As String
dwX As Long
dwY As Long
dwXSize As Long
dwYSize As Long
dwXCountChars As Long
dwYCountChars As Long
dwFillAttribute As Long
dwFlags As Long
wShowWindow As Integer
cbReserved2 As Integer
lpReserved2 As Long
hStdInput As Long
hStdOutput As Long
hStdError As Long
End Type

Private Type PROCESS_INFORMATION
hProcess As Long
hThread As Long
dwProcessID As Long
dwThreadID As Long
End Type

Private Declare Function WaitForSingleObject Lib "kernel32" (ByVal _
hHandle As Long, ByVal dwMilliseconds As Long) As Long

Private Declare Function CreateProcessA Lib "kernel32" (ByVal _
lpApplicationName As String, ByVal lpCommandLine As String, ByVal _
lpProcessAttributes As Long, ByVal lpThreadAttributes As Long, _
ByVal bInheritHandles As Long, ByVal dwCreationFlags As Long, _
ByVal lpEnvironment As Long, ByVal lpCurrentDirectory As String, _
lpStartupInfo As STARTUPINFO, lpProcessInformation As _
PROCESS_INFORMATION) As Long

Private Declare Function CloseHandle Lib "kernel32" _
(ByVal hObject As Long) As Long

Private Declare Function GetExitCodeProcess Lib "kernel32" _
(ByVal hProcess As Long, lpExitCode As Long) As Long

Private Const NORMAL_PRIORITY_CLASS = &H20&
Private Const INFINITE = -1&
Private Const STILL_ACTIVE = &H103
Dim retval As Long

Function GetAcroPath() As String
Dim I As Integer
Dim strAcroDir(5) As String
Dim strLocatedAcroDir As String

strAcroDir(1) = "C:\Program Files\Adobe\Acrobat 3.0\Reader\"
strAcroDir(2) = "C:\Program Files\Adobe\Acrobat 4.0\Reader\"
strAcroDir(3) = "C:\Program Files\Adobe\Acrobat 5.0\Reader\"
strAcroDir(4) = "C:\Program Files\Adobe\Acrobat 6.0\Reader\"
'strAcroDir(5) = "C:\Program Files\Adobe\Acrobat 7.0\Reader\"
strLocatedAcroDir = ""
For I = 4 To 1 Step -1
If Dir(strAcroDir(I), vbDirectory) <> "" Then
strLocatedAcroDir = strAcroDir(I)
Exit For
End If
Next I
GetAcroPath = strLocatedAcroDir & "AcroRd32.exe"
End Function

Public Function ExecCmd(cmdline$)
Dim ret As Long
' Initialize the STARTUPINFO structure:
start.cb = Len(start)
' Start the shelled application:
ret& = CreateProcessA(vbNullString, cmdline$, 0&, 0&, 1&, _
NORMAL_PRIORITY_CLASS, 0&, vbNullString, start, proc)
'Save the value so the status can be checked later
retval = ret
ExecCmd = ret&
End Function

Private Sub lboPDFFiles_DblClick(Cancel As Integer)
Dim strFile As String
Dim strAcroReaderPath As String

'Preview the file with Adobe Acrobat Reader. Make sure it is closed
'before creating a new file.
If IsNull(lboPDFFiles.Value) Then Exit Sub
strAcroReaderPath = GetAcroPath()
If strAcroReaderPath = "" Then
MsgBox ("Cannot find directory for Acrobat Reader.")
Exit Sub
End If
If Dir(strAcroReaderPath, vbNormal) <> "" Then
strFile = "C:\MyPDFFiles\" & lboPDFFiles.Value
retval = ExecCmd(strAcroReaderPath & " " & strFile)
Else
MsgBox ("Cannot find Acrobat Reader program.")
End If
End Sub

Code in form:
'See if the preview is open
If retval <> 0 Then
boolAns = GetExitCodeProcess(proc.hProcess, retval&)
If retval = STILL_ACTIVE Then
MsgBox ("Acrobat Reader needs to be closed before the new file can
be created.")
Exit Sub
End If
End If
Call CloseHandle(proc.hProcess)
retval = 0

Note: I plucked this code out of a lot of code so it may be incomplete
or have extra code. The extra precaution about Reader being open was
that when editing was done on the form that overwrote a previous file,
Reader having that file open already caused an error. Also, be aware
that this code was written for Access 97. I hope this is similar to
what you're trying to do.

James A. Fortune
Nov 13 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Mark Lees | last post by:
Just installed 2003 and the help file sucks because it tries to connect to Microsoft Online Help which takes too long. When I run Access and I'm not connected to the internet, it seems to connect...
7
by: Wayne Aprato | last post by:
I have several Access 2003 mde databases. When I try to open them in Access 2002 I get the following error: "The Visual Basic for Applications project in the database is corrupt." ...
26
by: jamesbeswick | last post by:
I've been using Access since version 97 and I've migrated to 2003. I've noticed a substantial number of strange ActiveX/OLE and code corruption problems when writing databases. The only solution...
17
by: Mell via AccessMonster.com | last post by:
Is there a way to find out where an application was created from? i.e. - work or home i.e. - if application sits on a (work) server/network, the IT people know the application is sitting...
5
by: Grubsy4u | last post by:
Hi all, My name is Daniel Iam trying to learn visual basic and I have been having problems building a marco in Access 2003 that will allow me to extract data from my Excel 2003 spreadsheet into my...
2
by: lrheeza | last post by:
Hello everyone, I am a newbie at MS Access and I need help!!! I am importing an excel file using Import functionality in MS Access, all the fields are required but there are instances in the...
2
by: Access | last post by:
Anyone else experiencing corruption problems using Access 2003 to edit .adp files? I've been experiencing corruption problems with a particular database. I've tried copying all the objects into a...
3
by: HistoricVFP | last post by:
Hello, I’ve been given the task of importing .dbf files from a very old version of Visual FoxPro (version 2.1) into Access (2003). When I import the data straight to Access it errors with: ...
1
by: Joe Musty | last post by:
I want to prevent that the "next record button" is available before a subform and/or a picture completely loaded. What happens is that when I click "next" button of records of a form to see...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.