I am creating a VB 6 front end to an Access 2000 database and want to simulate Access’ capability of moving through the tab sequence of my controls by pressing Enter as well as Tab. I do this with the following code for each control (varies slightly for Option Buttons, the DateTimePicker, etc.):
Private Sub txtCheckNum_KeyPress(KeyAscii As Integer)
‘ Use the Enter key to advance to the next field.
If KeyAscii = Asc(vbCrLf) Then
SendKeys “{TAB}”
End If
End Sub
The problem is, when I press Enter to move from a text box, the text disappears. The data is still captured and sent to the DB when I append the record, but I don’t want my users to have to put up with this disconcerting behavior; plus, they may go back and add the data again, resulting in an error message that the text is too long for the field (because it is actually duplicated).
Thanks in advance for any help rendered.