Re: How to determine name of control with focus in Form_KeyDown

Tech-Archive recommends: Fix windows errors by optimizing your registry



Would be interested to know what you're using this for! This demonstrates by
popping a messagebox with the control's name:

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
MsgBox Me.ActiveControl.Name
End Sub

Remember that the form's Key Preview property has to be set to Yes for
Form_KeyDown to work!

--
There's ALWAYS more than one way to skin a cat!

Answers/posts based on Access 2000/2003

Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/200801/1

.



Relevant Pages

  • Avoiding Add a record
    ... Private Sub ID_AfterUpdate ... Dim strSQL As String ... When it exists i show a messagebox. ... My seqond question: When you are entering a new record and you don't wont to ...
    (microsoft.public.access.modulesdaovba)
  • Re: Flickering when showing forms modally
    ... Once the form is shown the first time, ... the only reason I hide and redisplay it is to make it modal. ... > If all you want is to display a messagebox after the form has finished ... > Private Sub Command1_Click ...
    (microsoft.public.vb.controls)
  • Re: Database Updating problem
    ... You aren't calling the Update method of the dataadapter. ... Add this line right before the line with the messagebox command ... > Dim dsUser As New DataSet ... > Private Sub frmUsers_Load(ByVal sender As System.Object, ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Interumping continuous form
    ... Private Sub Form_Current ... when opening the continuous form, ... The idea is to get a messagebox every time the next record is displayed ... So the code pauzes the record-displaying, shows a messagebox, you click ...
    (microsoft.public.access.formscoding)
  • Re: no focus
    ... Private Sub Stop_rit_AfterUpdate ... messagebox is displayed... ... which prevents the user from moving off the control until it passes your ... validation, or presses Esc to undo any changes. ...
    (microsoft.public.access.formscoding)