I have a database with a table, the table has attributes for documentation, and one of the fields I have storing the location of the document. The other significant field I have set in the table is the document name. I then create a join table to enable a many to many relationship between the documentation table and another table. What I want the user to see when they look at the table or subsequent form is the name of the documentation. This works, in that I have it tied to the primary key and I can see the table name well enough, but I want to make it so that when you click on the name in a form it will open up the document recorded in the location field. That is the ideal solution for me. I dont know how to do this...but then I decided to try giving the name field a hypertext link property in the table and then implementing it in the form. But when this is done, it just flat out refuses to work, the hand comes up but it doesnt go anywhere, and if I right click the hyperlink option is grayed out. Can anyone help me?
Its not a matter of an incorrect file location or it not being accessable from some computers, its that when you click on the link in a form made from a join table comprising of a tables primary id key, the hyperlinked name refuses to execute...the colour is hyperlink, the hand is a hyperlinked hand, but you click on it and nothing happens, and you right click on it and editing the hyperlink option is not an option. How would I go about hyperlinking with vba? do you have any links?
Create a label and I will call it OpenDoc. The reason for this is that the textbox does not have very good hyperlink properties. I have not had good luck with it anyway. If you have a textbox that displays the file location you can use that info.
In the labels OnClick event, you will either use your textbox that has the file location, or write a SQL statement to extract the file location from the table. Then you can type this Me.OpenDoc.HyperlinkAddress = and then your file location weather you use a textbox or a SQL query to get that location.
I have a textbox with the file location displayed called FileLoc that is stored in my table. Here is my code that opens an Excel document when I click the label OpenDoc
Private Sub OpenDoc_Click()
Me.OpenDoc.HyperlinkAddress = FileLoc
Do you display the file location on your form in a textbox? If so, what is the Name of the textbox.
If not, what is the table name and field name of the file location information.
I dont display the file location of the form in a text box on the form. The table and field name for the location where the location or webpage that the file is stored is:
The readable text in the textbox is Documentation.Name
The bound column is documentation.DocumentationID
So I would like the bound column to be documentationID, the text to display Documentation.Name and to have documentation.name hyperlinked with documentation.filelocation as the source page. I hope this helps clear it up.
ok. I hope this helps. I have creadted a quick database for you. One thing is that the Micrsoft DAO 3.6 Object Library must be checked. Goto the VBA IDE and goto Tools-->References to check.
Like I said earlier, the textbox can not have a hyperlink address assigned on the fly. So I created a label and made it look like a button. I know the code is rough, but I did it real quick and did my best to comment the code to help you understand what I did.
Of course you will not be able to open the files you see in my table, as I did not attach them.
Thank you for all your help, I am still having a problem, I read the code and changed it to fit my situation and it gives me an error. I have uploaded a sample i extracted from my main database that shows the problem I am having. The form in the sample database serves as a subform to another form I have, but it should not introduce extra complexity to the problem. I hope creating this helps save you time from the excellent help that I so much appreciate so far.