title: Ms access vba sink (catch) keydown event from a formless subform
body: <p>I am developing a program in access for maintaining test data for other applications. It is a generic program, not for a specific application. The test data  is assumed to be stored in database tables. Because my program does not know in advance which tables are part of the application to be stated, it reads the meta data from the application database and creates linked tables for each table. 
  For entering and maintaining the data, I have a form with a subform  control. This subform control does not have a predefined  source object. By setting the source object property to "table.[linkedtablename]" the subform can be used for data entry. When the user selects another application table from a list, that other table is assigned to the subform.
  This works pretty good. 
  Now I need to handle events from this subform. Because the subform source object is not a form, this is not obvious. It is no problem to catch events of the subform when they have no arguments. You can write the following code:</p>
  
  <p><code>Me.subformname.form.oncurrent = "=customoncurrent()"</code></p>
  
  <p>But how to catch a keydown event? This event is raised with 2 arguments (key code, shift).</p>
  
  <p>I cannot write:</p>
  
  <p><code>Me.subformname.form.onkeydown = "=customkeydown()"</code> </p>
  
  <p>In runtime, VBA will raise an error that arguments are missing in the event procedure declaration.</p>
  
  <p>I have tried to use the 'withevents' clause but without success. Perhaps I know too little about the possibilities of this clause.</p>
  
  <p>Can this problem be solved and how?</p>
  
  <p>Mark</p>