UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Display Pdf File When Double Clicking An Object    
 
   
PhilTFC
post Apr 28 2012, 09:28 AM
Post #1

New Member
Posts: 10



Please help
I am using Access 2007 and have a table to store PDF file certificates in (tblPDF) with 4 field names
1. pdfID (PK)
2. PDF (Attachment)
3. CertNumber (Number) indexed no duplicates
4. GaugeID (Number) (FK) from tblEquipment

The PDF certificates have unique certificate numbers.
I have an equipment table (tblEquipment) with a field called "SerialNumber" (Text) indexed no duplicates.
What i am trying to achieve is this, when i double click on the "SerialNumber" i want access to display the certificate relative to the serial number in PDF format.
Is this possible or am i going about it the wrong way?
Any help will be greatly appreciated

Go to the top of the page
 
+
Peter46
post Apr 28 2012, 09:48 AM
Post #2

UtterAccess VIP
Posts: 7,440
From: Oadby Leics, UK



1 You only refer to tables in your post. To do this you must use forms.

2. Which of the fields in tblPDF does the the Serial number in tblEquipment match to?
Go to the top of the page
 
+
PhilTFC
post Apr 28 2012, 10:26 AM
Post #3

New Member
Posts: 10



Hi Peter

Oops my mistake, i have a form with a subform based on a table (tblEquipment)

The "CertNumber" is the common field as this is indexed and no duplicates allowed.

The Serial number is the object i would like to double click to view the PDF certificate

example

[Serial Number] [Description] [Certificate Number]

[TW01] [Torque Wrench] [12345] <---------- certificate number in PDF table, this is the certificate for equipment TW01
TW02 [Torque Wrench] [12346] <---------- certificate number in PDF table, this is the certificate for equipment TW02

and so on

I hope this helps



Go to the top of the page
 
+
Peter46
post Apr 29 2012, 04:43 AM
Post #4

UtterAccess VIP
Posts: 7,440
From: Oadby Leics, UK



There is a function at the link below to open a single attachment for a record.
http://blogs.office.com/b/microsoft-access...ment-field.aspx
Copy it into a standard module.

To call the function you need to add code to your double-click event ..

Dim dbs As DAO.Database
Dim rst As DAO.Recordset

Dim strTable
Const strField = "[Certificate Number]" ' Attachment field name

strTable = "Select * from tblEquipment where [serial number] = " & Me.[serial number] ' sql to select current record

Set dbs = CurrentDb
Set rst = dbs.OpenRecordset(strTable)
OpenFirstAttachmentAsTempFile rst, strField
rst.Close
Go to the top of the page
 
+
PhilTFC
post Apr 29 2012, 07:15 AM
Post #5

New Member
Posts: 10



Thank you for that Peter i will give it a go and let you know how i get on.
It might be a few days as i think it might be beyond my capability at the moment.

cheers (IMG:style_emoticons/default/coffee1.gif)

Go to the top of the page
 
+

Thank you for your support! Reply to this topicStart new topic

Jump To Forum:
 



RSS Go to Top  ·  Lo-Fi Version Time is now: 19th June 2013 - 07:25 PM