S
swas
Hi,
I have a non-updateable datasheet subform. I am wanting to catch the subform
keypress and direct these to a combobox on the parent as if the keypress was
to the combobox directly.
I don't want to use sendkeys as all comments caution its use, and the
combobox may not have the focus anyway (I could ensure it does).
Using the following in the subform:
Private Sub Form_KeyPress(KeyAscii As Integer)
If (KeyAscii > 64 And KeyAscii < 91) Or (KeyAscii > 96 And KeyAscii < 123)
Then
'Alpha key so send to parent combo
Me.Parent.cboFiller = Nz(Me.Parent.cboFiller) & Chr(KeyAscii)
End If
'Prevent subform receiving keypress
KeyAscii = 0
End Sub
The ascii keys are received by the combo, but not displayed nor trigger
combobox events (Before / after update etc...). I understand these events may
not fire if the changes are from code, but not sure on the best way to
achieve the result I want, ideally including auto expand, enter etc...
Thoughts appreciated.
swas
I have a non-updateable datasheet subform. I am wanting to catch the subform
keypress and direct these to a combobox on the parent as if the keypress was
to the combobox directly.
I don't want to use sendkeys as all comments caution its use, and the
combobox may not have the focus anyway (I could ensure it does).
Using the following in the subform:
Private Sub Form_KeyPress(KeyAscii As Integer)
If (KeyAscii > 64 And KeyAscii < 91) Or (KeyAscii > 96 And KeyAscii < 123)
Then
'Alpha key so send to parent combo
Me.Parent.cboFiller = Nz(Me.Parent.cboFiller) & Chr(KeyAscii)
End If
'Prevent subform receiving keypress
KeyAscii = 0
End Sub
The ascii keys are received by the combo, but not displayed nor trigger
combobox events (Before / after update etc...). I understand these events may
not fire if the changes are from code, but not sure on the best way to
achieve the result I want, ideally including auto expand, enter etc...
Thoughts appreciated.
swas