Results 1 to 7 of 7
  1. #1
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Niagara Falls, New York, USA
    Posts
    1,878
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Enter Key Fires Hyperlink Field? (A2k (9.0.3821) SR-1)

    Enter Key Fires Hyperlink Field?

    A2k (9.0.3821) SR-1

    I have a Hyperlink field on a form.

    Every time I Enter Key through the form, after Enter Key on the Hyperlink field the system tries to find the Internet. Unable to open http://www.

    How do I get this field to fire only when it

  2. #2
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Enter Key Fires Hyperlink Field? (A2k (9.0.3821) SR-1)

    Try something like this in the KeyDown event of the control bound to the hyperlink field :

    <pre>Private Sub LinkField_KeyDown(KeyCode As Integer, Shift As Integer)
    If KeyCode = vbKeyReturn Then
    KeyCode = vbKeyTab
    End If
    End Sub</pre>

    Charlotte

  3. #3
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Niagara Falls, New York, USA
    Posts
    1,878
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Enter Key Fires Hyperlink Field? (A2k (9.0.3821) SR-1)

    Perfect

    I guess this normal behavior, seems strange.

    The hyper link control even fires when the control is locked.

    Thank, John

  4. #4
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Enter Key Fires Hyperlink Field? (A2k (9.0.3821) SR-1)

    Keep in mind that behavior is context sensitive. When the focus shifts to a hyperlink, the natural behavior is to react to an Enter the same way as to a mouse click. I haven't tried it, but a Space bar would probably give you the same problem.
    Charlotte

  5. #5
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Niagara Falls, New York, USA
    Posts
    1,878
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Enter Key Fires Hyperlink Field? (A2k (9.0.3821) SR-1)

    Hi Charlotte

    I'm trying to disable the left mouse click, its not working, the hyperlink fires on left mouse click

    Any ideas

    Thanks, John


    <pre>Private Sub hypAttachment_KeyDown(KeyCode As Integer, Shift As Integer)

    ' this prevents hyperlink field firing on enter key or mouse click
    If KeyCode = vbKeyReturn Or KeyCode = vbKeyLButton Then
    KeyCode = vbKeyTab
    End If

    End Sub
    </pre>


  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Enter Key Fires Hyperlink Field? (A2k (9.0.3821) SR-1)

    I don't understand - the idea of a hyperlink is that you can click it to follow it. If you don't want to do so, you don't need a hyperlink.

    You can set the Enabled property of the text box to No, and Locked to Yes to prevent the user from following a hyperlink.

    (On KeyDown reacts to keyboard events, you'd need to use On MouseDown to react to mouse events.)

  7. #7
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Niagara Falls, New York, USA
    Posts
    1,878
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Enter Key Fires Hyperlink Field? (A2k (9.0.3821) SR-1)

    Thanks for the info, see reason <post#=466908>post 466908</post#>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •