Hi,
We have a database at work with a register of all the chemicals we use on a daily basis. Each of these chemicals comes with a pdf document specification. All of these documents are stored in the folder C:\chemicals\pdf\.
What I'm working on is a way to connect each record in the database to the corresponding pdf document in the folder. The filename of each document is the same as the autoID of the record in the database. ex. 5013.pdf.
So far i have come up with the following code in the on_click event of a pdf icon image in the main form:
This code works fine, but I want to hide the pdf icon (which contains the on_click event) on my form if the code cant find a document with that same ChemID number.
This could perhaps be done throught Form_Open?
Could anyone of you maybe slip me a line of code to help me on my way?
thanks!
We have a database at work with a register of all the chemicals we use on a daily basis. Each of these chemicals comes with a pdf document specification. All of these documents are stored in the folder C:\chemicals\pdf\.
What I'm working on is a way to connect each record in the database to the corresponding pdf document in the folder. The filename of each document is the same as the autoID of the record in the database. ex. 5013.pdf.
So far i have come up with the following code in the on_click event of a pdf icon image in the main form:
Code:
Private Sub pdfico_Click()
On Error GoTo ErrorMessage
FollowHyperlink "C:\Chemicals\pdf\" & Me.ChemID & ".pdf"
Exit_pdfico_Click:
Exit Sub
ErrorMessage:
MsgBox "Can't find document."
End Sub
This code works fine, but I want to hide the pdf icon (which contains the on_click event) on my form if the code cant find a document with that same ChemID number.
This could perhaps be done throught Form_Open?
Could anyone of you maybe slip me a line of code to help me on my way?
thanks!