D
Dave
We just migrated to 2007 from 2003. I swear that before the migration, the Keypress event for a textbox fired and the code inserted a carriage return & line feed when the user pressed the Enter key on that control. Now it does not, and I have tried all day to fix this (added 2 more events to test) and can report the following:
the form is bound; Keypreview is set to Yes; all form command buttons are set to Default-no and Cancel-no; swapped keyboards (desperate! no change)
press a T key...
1) KeyDown: KeyAscii=0, KeyCode=84
2) KeyPress: KeyAscii=166, KeyCode="Empty"
3) KeyUp does not fire.
press Enter key...
1) KeyDown: KeyAscii=0, KeyCode=0
2) KeyPress & KeyUp don't fire
This is the pertinent part that worked before, but will never work now thatthe KeyAscii value being returned is always 0:
If KeyAscii = 13 Then
If Me.Dirty = True Then Me.Dirty = False 'user may have deleted alltext so force save on field
If IsNull(txtShipReason) Then Exit Sub 'if field is now null, exit sub
lngPos = Len(txtShipReason) 'determine number of characters
txtShipReason.SelStart = lngPos 'move to the end of the text
SendKeys "^{ENTER}" 'enter the line wrap
End If
I'm stumped! Could it be the migration? I have been working on opening thisform in various modes (view, new, edit) and wonder if it could have something to do with form properties such as AllowEdits. HOWEVER, before you jumpon that one, this coded no longer works in the current production version of the database either, which was in use before the migration. Any ideas out there?
the form is bound; Keypreview is set to Yes; all form command buttons are set to Default-no and Cancel-no; swapped keyboards (desperate! no change)
press a T key...
1) KeyDown: KeyAscii=0, KeyCode=84
2) KeyPress: KeyAscii=166, KeyCode="Empty"
3) KeyUp does not fire.
press Enter key...
1) KeyDown: KeyAscii=0, KeyCode=0
2) KeyPress & KeyUp don't fire
This is the pertinent part that worked before, but will never work now thatthe KeyAscii value being returned is always 0:
If KeyAscii = 13 Then
If Me.Dirty = True Then Me.Dirty = False 'user may have deleted alltext so force save on field
If IsNull(txtShipReason) Then Exit Sub 'if field is now null, exit sub
lngPos = Len(txtShipReason) 'determine number of characters
txtShipReason.SelStart = lngPos 'move to the end of the text
SendKeys "^{ENTER}" 'enter the line wrap
End If
I'm stumped! Could it be the migration? I have been working on opening thisform in various modes (view, new, edit) and wonder if it could have something to do with form properties such as AllowEdits. HOWEVER, before you jumpon that one, this coded no longer works in the current production version of the database either, which was in use before the migration. Any ideas out there?