Access (2003) VBA solution needed to allow the user, using a form, to insert a hyperlink for a file of their choosing, into a record. Also, need to start from a default directory.
Posted on 2006-03-27
Hello Experts. I had a very useful little send-keys solution which allowed the user to insert a hyperlink, for a file of their choosing, into a record. The user, seeing the record fields as displayed on a form, would click on a button, titled “Add Link”. Upon doing so, the focus would go to the hyperlink field and the “send-keys” actions would navigate the user to the proper directory where the files were located. When I converted the database to Access 2003, the send-keys have simply refused to work consistently. I have tweaked them to fit the navigation changes in the dialog box, however, the code does not consistently work.
In all honesty, I’d like to get out of using the send-keys altogether.
Here’s the VBA that I had in the Access 97 database:
Private Sub cmdAddLink_Click()
Me.path.SetFocus 'Sets the focus to the path field on subform
SendKeys "%II" 'Brings up the Hyperlink Menu Option and then brings up “Insert”
SendKeys "\\jefferson\images\active" 'Enters the path in the dialog box
. . . from this point, the user takes over and selects the image of their choosing.
Does anyone have a good way to do this without using Send-Keys?