Event on enter button

  • Thread starter Thread starter Guest
  • Start date Start date
Hi,
do you mean you want to execute VBA code when a user presses the enter key
on their keyboard.
If so then there are a couple different options.
You could add a command button to the form...add your code to the on click
event of the command button. Then set its default property to YES (you can
find that property under the other tab in its property window). If you don't
mind the button being there then just leave it as is and if the user presses
the enter key on that form no matter where they are the code behind the
buttons on click event will be executed. If you don't want it visible then
set the buttons transparency property accordingly.
Furthermore, another approach would be to add evaluation code on the form's
keydown or keypress event which checks if the enter key was pressed and if
yes then execute your other code. Yet another option would be to set up an
AutoKeys macro which then executes your code. Look up autokeys in the access
help and it will guide you in setting up the macro and show you sample
syntax. Keep in mind that an autokeys macro will act globally in the whole
application unless you build in a functionality which makes it form specific.
HTH
Good luck
 
Thanks
But it is in a memofield i shall use this event
like every time the user make a new line then
it shall do the event.......

regards
alvin
 
Hi,
what are you trying to do on the enter key in this control.
If it is a textbox control bound to your table memo field and you want to
force a new line when enter is pressed then you can just alter the controls
'enter key behavior' which you find under the other tab of the control's
property window.
BTW...forms hold controls...fields are in tables.
HTH
Good luck
 
Back
Top