Controlling the return or enter key in controls

darbid

Registered User.
Local time
Today, 22:02
Joined
Jun 26, 2008
Messages
1,428
What controls what Access forms do when the enter key is pressed?

More specifically I have two problems:

I have a webbrowser embedded in a form but when people hit enter the focus is changed to another control on the form, I need the enter key to be recognised on the webbrowser control.

Or in text box controls, when you press enter it moves the focus to another control.

I am sure there is a easy setting for this.

thanks.
 
Under Properties in memo fields there is an option for Enter = New Line OR Enter = Next Field.

If this won't do it for you, you may have to use the KeyDown event of your control, and intercept the Key event.

Evan
 
Under Properties in memo fields there is an option for Enter = New Line OR Enter = Next Field.

Thanks evan that gave me the exact words I need to search for. What I thought was a simple question was not quite so for the webbrowser control.

It appears as though the enter key behaviour and the webbrowser control is a known "question/problem/issue" with very little on it. Most people I suppose do not need to use the Enter key. Secondly in webdesign the designer must allow the enter-key to be used by setting up an evenlistener.

This means that if the webpage does not listen for the enter key you are going to have problems.

I am not going to try and take this issue any further. For people that really need to implement this it appears that one method is to capture the enter key press and use the SENDMESSAGE function of the API to send it to your webbrowser control.

Code:
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Const WM_CHAR = &H102Call 
SendMessage(PopupHwnd,WM_CHAR,13,0&)
 

Users who are viewing this thread

Back
Top Bottom