yes, that was a pretty brief answer; had system problems and couldn't get
into my Access program. i set up the very thing you're describing: created
a table with two records, one containing the filepath to Adobe Reader on my
PC, and the other containing the filepath to the folder holding the files i
want to open. the filenames are in another table that i update periodically
as new files are added to the folder. in the data entry / search form bound
to the second table, i added a command button to run the code that opens
Adobe Reader and then opens the PDF file i'd selected in the search form.
code is posted below; note that i've just copied my specific code as an
*example*, so you'll need to replace tablenames, fieldnames, controlnames,
etc. for illustrated instructions on how the create a VBA procedure in a
form module, go to
http://home.att.net/~california.db/instructions.html and
click the CreateEventProcedure link. also, read up on DLookup() function,
Shell, and FollowHyperlink in Help, so you'll understand how they work.
hth
Private Sub cmdLink_Click()
On Error GoTo cmdLink_Err
Dim str As String
str = DLookup("fpPath", "tbl00FilePaths", "fpID = 6") _
& Format(Me!ChildDetails.Form!docDate, "yyyy_mmdd_") _
& Nz(Me!ChildDetails.Form!docLtr, "A") & ".pdf"
Shell DLookup("fpPath", "tbl00FilePaths", "fpID = 7"), _
vbMaximizedFocus
Application.FollowHyperlink str, , , False
cmdLink_End:
Exit Sub
cmdLink_Err:
Select Case err.Number
Case 432 ' filepath not found.
MsgBox "The filepath is incorrect." _
& vbCr & vbCr _
& "Sorry, you'll have to open the PDF " _
& "file manually from Windows Explorer."
Resume cmdLink_End
Case 53 ' file not found
MsgBox "The Adobe Acrobat program was not found." _
& vbCr & vbCr _
& "Sorry, you'll have to open the PDF " _
& "file manually from Windows Explorer."
Resume cmdLink_End
End Select
End Sub