Question : How do I suppress default click behaviour on hyperlink field on form?

Is there any way to suppress or cancel Access' default behaviour to open the document addressed in a hyperlink field when the associated form control is clicked?

I have an Access 2007 database with several tables containing hyperlink fields. I have written my own code for the OnClick event of the text box controls bound to the hyperlink fields, and this works fine. However, having completed, Access then executes the default hyperlink click behaviour, so that the document is opened again. Is there any way of suppressing or cancelling this default behaviour? I realise that I could eschew hyperlink fields altogether and just use normal text fields with separate fields for DisplayName and Address, but I am reluctant to do this if I can avoid it.

Also: is there any way to suppress the Windows security dialog which opens when you click on a hyperlink?

Answer : How do I suppress default click behaviour on hyperlink field on form?

You can do the following (I think)
If mouse enter the field, to show the hyperlink text and allows for editing.
To follow the link double click the field.
Assume the hyperlink field is (hl)

Private Sub hl_DblClick(Cancel As Integer)
    hl.Hyperlink.Follow
End Sub

Private Sub hl_Enter()
    hl.SelStart = 1
End Sub

Private Sub hl_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    hl.SetFocus
    hl.SelStart = 1
End Sub
Random Solutions  
 
programming4us programming4us