Re: OutputTo a Report
From: SA (~fake.address_at_nspm.com)
Date: 03/16/04
- Next message: SanDeep: "Re: Reports to open 75%"
- Previous message: Neil: "Re: Generating/Invoking "Report Wizard""
- In reply to: Nadia: "OutputTo a Report"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 16 Mar 2004 08:55:03 -0500
Nadia:
1.) Reports are not "active" documents; so if you had the name of the pdf
document displayed on the report that was the result of your QBF, the user
can't click on it in the report to launch Adobe Acrobat or Acrobat reader
and display the target PDF file.
2.) Forms on the other hand will respond to user mouse clicks etc, so if
your query by form displays in a field the PDF document and its associated
path (e.g. c:\some directory\pdf files\target pdf file.pdf) then you could,
through use a of a bit of code launch the appropriate application and open
the file. However, this takes a bit of Visual Basic code to do. Listed
below is code that you can place in a general module in your database that
will find the current install of Acrobat and launch it and open a target PDF
file.
In your form, assuming again you'd display the path to a PDF file, then set
the double click event for the control that displays the path to an event
procedure and in the event procedure add code like this that calls the
functions below:
Dim boolReturn as boolean
boolReturn = DisplayPDF(Me!NameOfControlWithPathToPDFFile)
-- Steve Arbaugh ACG Soft http://ourworld.compuserve.com/homepages/attac-cg ====== Begin Code - Cut and Past into a General Module =========== 'General Module Declarations Option Compare Database Option Explicit Private Declare Function RegCloseKey Lib _ "advapi32.dll" (ByVal hKey As Long) As Long Private Declare Function RegOpenKeyEx Lib _ "advapi32.dll" Alias "RegOpenKeyExA" _ (ByVal hKey As Long, ByVal lpSubKey As String, _ ByVal ulOptions As Long, ByVal samDesired As Long, _ phkResult As Long) As Long Private Declare Function RegQueryValueExString Lib _ "advapi32.dll" Alias "RegQueryValueExA" _ (ByVal hKey As Long, ByVal lpValueName As String, _ ByVal lpReserved As Long, lpType As Long, _ ByVal lpData As String, lpcbData As Long) As Long Private Function acg_GetAcro() As String 'By ACG Soft 'http://ourworld.compuserve.com/homepages/attac-cg Dim dwReturn&, hKey&, strData$, dwType& Const HKEY_LOCAL_MACHINE = &H80000002 Const REG_SZ = 1 Const REG_KEY_READ = &H20019: Const intBuffSZ = 260 Const ERROR_NONE = 0 dwReturn = RegOpenKeyEx(HKEY_LOCAL_MACHINE, _ "SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\Acrobat.exe", _ 0, REG_KEY_READ, hKey) If dwReturn = ERROR_NONE Then strData = Space(intBuffSZ) dwReturn = RegQueryValueExString(hKey, "Path", 0&, _ dwType, strData, Len(strData)) If dwReturn = ERROR_NONE Then acg_GetAcro = left(strData, _ InStr(strData, Chr(0)) - 1) & "Acrobat.exe" Else acg_GetAcro = "" End If RegCloseKey (hKey) Else dwReturn = RegOpenKeyEx(HKEY_LOCAL_MACHINE, _ "SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\AcroRd32.exe", _ 0&, REG_KEY_READ, hKey) If dwReturn = ERROR_NONE Then strData = Space(intBuffSZ) dwReturn = RegQueryValueExString(hKey, "Path", 0&, _ dwType, strData, Len(strData)) If dwReturn = ERROR_NONE Then acg_GetAcro = left(strData, _ InStr(strData, Chr(0)) - 1) & "AcroRd32.exe" Else acg_GetAcro = "" End If RegCloseKey (hKey) End If End If End Function Public Function DisplayPDF(strTargetPDF As String) As Boolean 'By ACG Soft 'http://ourworld.compuserve.com/homepages/attac-cg On Error Resume Next Dim strAcroPath As String, dwReturn As Long DisplayPDF = False If Len(Dir(strTargetPDF)) < 1 Then 'File not found MsgBox "The target PDF file doesn't exist", 16 Exit Sub End If strAcroPath = acg_GetAcro() If Len(strAcroPath) > 0 Then strAcroPath = strAcroPath & " " & strTargetPDF dwReturn = Shell(strAcroPath, vbNormalFocus) DoEvents DisplayPDF = True Else MsgBox "Neither Adobe Acrobat or Acrobat Reader is installed on this computer", 16 End If End Function =========End Code ================ "Nadia" <anonymous@discussions.microsoft.com> wrote in message news:BF06EABE-DA59-4A48-B5C1-D588487D3A82@microsoft.com... > Hi...I've set up a form to perform a query, and now I'm trying to improve the user-friendliness of the QBF output. I'd like the results of the query to be output to a report. because I have some OLE objects that need to be accessed from the results (i.e. the OLE objects are journal articles in pdf format, that the user searches for using the QBF, and I want them to be able to open the OLE object right from the results of the QBF). I've tried using the OutputTo Macro, but I can't get it to work. This is my first experience with computer programming...any help or advice would be appreciated!
- Next message: SanDeep: "Re: Reports to open 75%"
- Previous message: Neil: "Re: Generating/Invoking "Report Wizard""
- In reply to: Nadia: "OutputTo a Report"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|