I have a subform for data entry with just textboxes on it. It displays in datasheet view.
I would like to have the onkeydown event for all textboxes on the form call a procedure.
But the user has the ability to run a procedure to add fields to the underlying table and add corresponding fields to the subform. So I need a way to get the newly generated field to also 'inherit' the onkeypress event.
The following (red) proc call is currently associated with one textbox. How can I make this proc available to the as yet non-existent fields upon their creation by the user?
-------------------------------------
Where would we be if we didn't try?
I would like to have the onkeydown event for all textboxes on the form call a procedure.
But the user has the ability to run a procedure to add fields to the underlying table and add corresponding fields to the subform. So I need a way to get the newly generated field to also 'inherit' the onkeypress event.
The following (red) proc call is currently associated with one textbox. How can I make this proc available to the as yet non-existent fields upon their creation by the user?
Code:
Private Sub Text50_KeyDown(KeyCode As Integer, Shift As Integer)
[COLOR=#ff0000]Call dfltCursorDirection(KeyCode, Shift)[/color]
End Sub
Public Sub dfltCursorDirection(KeyCode As Integer, Shift As Integer)
If Me.Parent.Parent!grpCursorDirection = 2 Then
'User has chosen to have cursur move
'up and down when hitting Tab and Enter, so...
On Error Resume Next
With Me.Recordset
Select Case KeyCode
Case vbKeyTab, vbKeyReturn
Select Case Shift
Case 0
.MoveNext
If .EOF Then
' .MoveFirst
End If
Case acShiftMask
.MovePrevious
If .BOF Then
' .MoveLast
End If
Case Else
'ignore
End Select
Case Else
'Ignore
End Select
End With
End If
End Sub
-------------------------------------
Where would we be if we didn't try?